Sunday, 09.08.2020, 21:34
Welcome Guest | RSS
Site menu
Login form
Section categories
Search
Calendar
«  June 2011  »
SuMoTuWeThFrSa
   1234
567891011
12131415161718
19202122232425
2627282930
Entries archive
Our poll
Rate my site
Total of answers: 6
Statistics

Total online: 1
Guests: 1
Users: 0
Main » 2011 » June » 10 » Multiplication table in text file
17:55
Multiplication table in text file
//Note, this works only by GCC compiler
#include <iostream>
#include <fstream>
using namespace std;

#define r m

int bazm(int x,int y){

    return (x*y);
}

int main()
{
    cout<<"Enter the quantity of numbers"<<endl;
    int m;
    cin>>m;
    ofstream out("out.txt");
    int i, j;
    int a[r][r];
    for (i=0;i<r;i++){
    for (j=0;j<r;j++)
    a[i][j]=bazm(i,j);
    }

 for (i=0;i<r;i++){
    out<<endl;
    for (j=0;j<r;j++)
        out<<i<<" * "<<j<<" = "<<a[i][j]<<endl;
            }
            cout<<"The result has been saved in out.txt";
            return 0;}

Category: C++ programs | Views: 407 | Added by: H_Imirzyan | Tags: text, Multiplication table, Multiplication, file | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *: