DevC++ error

Started by
5 comments, last by brandonman 18 years ago
I'm doing a project in DevC++ right now( a greeting, user puts in their name and the computer prints a greeting for them), but I keep getting two errors when compiling. Error 1 is:3 C:\Dev-Cpp\textgame.cpp expected unqualified-id before '{' token . Error 2 is:3 C:\Dev-Cpp\textgame.cpp expected `,' or `;' before '{' token . Here's the source. { printf("welcome, type your name:") scanf("%s",&n); printf("hello %s") } Tell me what I am doing wrong please. This happens on all of my programs from having { printf("hello world"), to {scanf("%d",&a);printf("you entered %d")
Advertisement
You're missing semicolons after both printf statements.
should be

{
printf("welcome, type your name:");
scanf("%s",&n);
printf("hello %s", n);
}
accidentaly double posted, sorry. thank you though
tried it but I am still getting the same errors I posted.
1.) Are you including the right headers? (#include <stdio.h>)

2.) Are you typing int main() right before the first {?
------------------------------Support the Blue Skies in Games Campaign!A blog... of sorts.As a general rule, if you don't have a general rule in your signature, you aren't as awesome as someone who does. General rules roxor teh big one one ones.
now I am.

This topic is closed to new replies.

Advertisement