Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Table 2 to 20 (http://www.go4expert.com/forums/table-2-to-20-t17455/)

riz09 10May2009 20:23

Table 2 to 20
 
hi all... thanx my dear Saswatpadhi for helping me... thnx alot..
i have headache due to my this problem.. hope u can help me..

i have to print tables from 2 to 20 in order that once a table is viewed.. then a message displays that Press any key to continue.. then if i press any key then the next table displays..

till now i can only print 2 to 20 tables but i didnt control over this message that Press any key to continue..
it makes some errors.. so please kindly help me...
-----
Raza Elahi

SaswatPadhi 10May2009 23:16

Re: Table 2 to 20
 
There are two ways to display the message :

(1) Through the console :
Code: c++

system("pause")// use #include <stdlib.h>
 

(1) Through C or C++ :
Code: c++

printf("Press any key to continue ...\n");
getchar();


So, the final code will be :
Code: c++

#include <stdio.h>
#include <stdlib.h>

int main()
{
      int Cnt, X;
      for(Cnt = 2; Cnt < 21; ++Cnt)
      {
            for(X = 1; X< 11; ++X)   // The table
                  printf("%d * %d = %d\n", Cnt, X , Cnt*X);
            putchar(10)// print a newline
            system("pause");
            putchar(10)// print a newline
      }
      return 0;
}


riz09 11May2009 14:28

Re: Table 2 to 20
 
Thanx.. i use ur first code.. nd it works.. thank u

SaswatPadhi 11May2009 17:00

Re: Table 2 to 20
 
Quote:

Originally Posted by riz09 (Post 47599)
Thanx.. i use ur first code.. nd it works.. thank u

As shabbir says, "The pleasure is all mine" ! :smile:

shabbir 11May2009 17:26

Re: Table 2 to 20
 
Quote:

Originally Posted by saswatpadhi (Post 47605)
as shabbir says, "the pleasure is all mine" ! :smile:

haha :D

xpi0t0s 11May2009 17:43

Re: Table 2 to 20
 
I know this isn't what anyone wants to hear but if you keep giving riz09 completed code he'll keep being dependent instead of learning for himself how to program. This is a REALLY EASY task he should have been able to figure out for himself.

riz09: by all means ask for help, but completed examples don't help you. When you get to the exam where you can't ask on go4expert, you'll be completely stuck and will fail the exam. Have a go instead of posting here, and ask for help with what you're stuck on.

The problem of course is that your assignments will get increasingly difficult so you need to break this dependency cycle as soon as possible.

SaswatPadhi 11May2009 17:58

Re: Table 2 to 20
 
Never thought about it this way, but :iagree:.
Next time, show us your progress first and then we will help. We won't do your homework here.

riz09 12May2009 20:37

Re: Table 2 to 20
 
u all r right but my dear friends.. i m a hard worker.. u knw daily i do miscellaneous projects nd sometimes i got success but sometimes i lose.. thats y i try again nd again.. but i m only here to sort out whats missing in my program.. what problem i m facing.. i m only here to ask u all.. bcoz this is the portal where v can share our problems regarding programming....

Actually in our college there's not a teacher of ICP (introduction to computer programming) thats y i m facing these problems as exams is near..

To Mr. Admin..

am i having a right to post here my problems or faces this type of posts..?


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