Motoxrdude
Active Member
Write the most concise, but clearly readable program according to this specification:
1. Say: "Hi! What's your name? "
2. User enters name.
3. Say: "Hello, (username)! Welcome to ComputerForum!"
You can also use a simple GUI, like a dialog box, to ask the question, input name, etc
Try not to hog too many languages. Give other posters a fair go at posting their example too. If you are posting an alternative version of code for a language that has already been posted, mention that it is an alternative version.
C
1. Say: "Hi! What's your name? "
2. User enters name.
3. Say: "Hello, (username)! Welcome to ComputerForum!"
You can also use a simple GUI, like a dialog box, to ask the question, input name, etc
Try not to hog too many languages. Give other posters a fair go at posting their example too. If you are posting an alternative version of code for a language that has already been posted, mention that it is an alternative version.
C
Code:
#include <stdio.h>
int main()
{
char name[64];
printf("Hi! What's your name? ");
scanf("%s", &name);
printf("Hello, %s! Welcome to ComputerForum!\n", &name);
return 0;
}