could anybody pls help mi!!!i do nt knw y my program go infinite loops.could anybody cn pls solve my problem.it is veri urgent!!!!!!no matter hw i change,i still cnnot gt the output tat i wan.cn anybody pls help 2 change my code.i will be delightful if anybody cn solve my problem!!!!!
example output:
* 1 2 3 4 5 6 7
----------------------
1 1 2 3 4 5 6 7
2 2 4 6 8 10 12 14
3 3 6 9 12 15 18 21
4 4 8 12 16 20 24 28
5 5 10 15 20 25 30 35
// To construct a timetable
#include <iostream>
using namespace std;
// Function prototypes
int getInt (int);
void displayTimeTable (int,int);
int main ()
{
int rows;
int column;
int n;
int i;
// Reading data validation
rows = getInt (0);
column = getInt (0);
displayTimeTable (n,i);
}
int getInt (int i)
{
int rows;
int column;
int n;
do
{
cout << "Enter the rows: ";
cin >> n;
cout << "Enter the column: ";
cin >> n;
cout << endl;
if (n > 10)
cout << "Please input a positive integer N that is smaller than 10" <<endl;
else
cout << "Multiplication TimeTable" <<endl;
cout << endl;
}while (n < i);
return n;
}
void displayTimeTable (int n,int i)
{
cout << "*";
for (int n = 1; n <= i; n++)
cout << "\t" << n;
cout << endl;
cout <<"----------------------------------------------------------\n";
for (int i = 1; n < i; ++n)
{
cout << n;
for (int j = 1; n <= i
cout << "\t" << n * j;
cout << endl;
}
}
example output:
* 1 2 3 4 5 6 7
----------------------
1 1 2 3 4 5 6 7
2 2 4 6 8 10 12 14
3 3 6 9 12 15 18 21
4 4 8 12 16 20 24 28
5 5 10 15 20 25 30 35
// To construct a timetable
#include <iostream>
using namespace std;
// Function prototypes
int getInt (int);
void displayTimeTable (int,int);
int main ()
{
int rows;
int column;
int n;
int i;
// Reading data validation
rows = getInt (0);
column = getInt (0);
displayTimeTable (n,i);
}
int getInt (int i)
{
int rows;
int column;
int n;
do
{
cout << "Enter the rows: ";
cin >> n;
cout << "Enter the column: ";
cin >> n;
cout << endl;
if (n > 10)
cout << "Please input a positive integer N that is smaller than 10" <<endl;
else
cout << "Multiplication TimeTable" <<endl;
cout << endl;
}while (n < i);
return n;
}
void displayTimeTable (int n,int i)
{
cout << "*";
for (int n = 1; n <= i; n++)
cout << "\t" << n;
cout << endl;
cout <<"----------------------------------------------------------\n";
for (int i = 1; n < i; ++n)
{
cout << n;
for (int j = 1; n <= i
cout << "\t" << n * j;
cout << endl;
}
}