Friday, December 19, 2008
C/C++ Forum
welcome to infomix.blogspot.com
Ok, It's been a while since last I programmed and I'm kind of new too but let me try (I have no way to test it so I won't know if it has any mistakes. Test it!)
Before you use this keep in mind it is intended for C, not C++. The difference? So far as I can see, the only problem in this program would be that you have to write #include one more time to call conio.h
#include
/*I called the libraries I need. They are like dictionaries that tell the computer the meaning of the words I write. The word getch at the bottom of the code, for example, wouldn't work I didn't tell the program to use use conio.h*/
/*.h means header*/
main (void) { /*If you don't write void in the parenthesis, you'll have to write return 0 at the end of the code in this case.*/
int n=0, sum=0, count=0, square=0
/*I just decided what my variables would be. Don't write my comments in your program. I'll use them to guide you. You may comment in your own program if it's too long or complex*/
/*I set them all in 0 because if I do otherwise and use the variable without first assigning it a value, it will take a random one.*/
printf ("Please tell me how many numbers will you enter");
/*printf will just print what you write between the "" inside the parenthesis*/
scanf ("%d", &n);
/*I put whatever number the user entered in n. If you don't use the &, it will not work. It has to be a number: the d says so*/
while (count
Before you use this keep in mind it is intended for C, not C++. The difference? So far as I can see, the only problem in this program would be that you have to write #include one more time to call conio.h
#include
/*I called the libraries I need. They are like dictionaries that tell the computer the meaning of the words I write. The word getch at the bottom of the code, for example, wouldn't work I didn't tell the program to use use conio.h*/
/*.h means header*/
main (void) { /*If you don't write void in the parenthesis, you'll have to write return 0 at the end of the code in this case.*/
int n=0, sum=0, count=0, square=0
/*I just decided what my variables would be. Don't write my comments in your program. I'll use them to guide you. You may comment in your own program if it's too long or complex*/
/*I set them all in 0 because if I do otherwise and use the variable without first assigning it a value, it will take a random one.*/
printf ("Please tell me how many numbers will you enter");
/*printf will just print what you write between the "" inside the parenthesis*/
scanf ("%d", &n);
/*I put whatever number the user entered in n. If you don't use the &, it will not work. It has to be a number: the d says so*/
while (count
0 Responses to "C/C++ Forum"
Post a Comment