well thanks anyway
i just got to a part in the book that says to much programming in
one day makes you c sick.
I know, cheesy
but true
i'll try again tomorrow
well thanks anyway
i just got to a part in the book that says to much programming in
one day makes you c sick.
I know, cheesy
but true
i'll try again tomorrow
GCC 1 and it isn't hard but I suck at this and I'm not used to edting other peoples code.Originally posted by Elite
i didnt think it would be so difficult to write such a simple program
maybe i should stick with gamestudio
what compiler r u using?
They say that if you play a Windows Install CD backwords, you hear satanic messages. That's nothing; play it forward and it installs Windows.
Elite,
Below your # include statements you initialize the function as "sub", but everywhere else in your code it's referred to as "subb". I'm not sure if this is the reason for your specific error message(s), but thought you should know.
Okay, finally got the (altered) code working:
I added the system("PAUSE") lines so you could view the output before your window closes, in case you're using a Windows machine like I am & not calling the .exe from the command prompt in DOS. Also, I usually initialize the functions before main(). Not sure if that's "good form", it's just the way I am learning to do it. Hope this helps, from 1 student to another.Code:#include <stdio.h> #include <string.h> void subb() { int r; int t; int q; printf("Please enter a number the press enter : "); scanf("%d",&r); printf("What would you like me to add to that number? : "); scanf("%d",&t); q=r+t; printf("%d plus %d equals %d",r,t,q); printf("\n"); system("PAUSE"); } void nam() { char x[20]; char kate[] = {"kate"}; printf("Please enter your name : "); scanf("%s",x); if(strcmp(x, kate) == 0) printf("Thats a great name!!!!"); else printf("Ha, what a crap name!!!"); printf("\n"); system("PAUSE"); } int main() { char test = 'a'; char c; printf("Hi, I am the name genie and i am good at addition\nWhat would you like to do?\nPress A to add or B to get insight into your name"); scanf("%c",&c); if(c == 'a') subb(); else nam(); return 0; }
Hey thanks dbyte but i still get the same error so it is definately the compiler, i'll try one of those free compilers and see what i get.
Thanks again
I just reinstalled msvc++ and the code works fine now.
Maybe i accidentally changed a header file or something
i get an undeclared identifier with the system bit so i just commented it out but it works without it
Thanks again