Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 28-10-2008, 04:31 PM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Oct 2008
Posts: 1
Default pls help c++construct timetable


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;
}
}
crystal is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 28-10-2008, 04:49 PM   #2 (permalink)
Legen-wait for it-dary!
 
dheeraj_kumar's Avatar
 
Join Date: Dec 2004
Location: Chennai
Posts: 2,471
Default Re: pls help c++construct timetable

Sorry for the really frank answer but...most of the stuff seems to be unnecessary. Of course, if you need to use it for your own purposes, go on, but if this is the entire program, it could use some cleaning up.

Here is the infinite loop...

Code:
for (int j = 1; n <= i;)
cout << "\t" << n * j;
__________________
If the Start Windows Restart when Windows starts check box is checked Windows Restart will start automatically every time Windows is started. - Actual excerpt from a windows program help file
dheeraj_kumar is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
construct & function Trinity QnA (read only) 9 10-07-2005 02:26 PM

 
Latest Threads
- by topgear
- by Charan

Advertisement




All times are GMT +5.5. The time now is 05:54 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2