![]() |
| |||||||
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| CN Owner | Lets Begin. Create your main class and add the include stdio.h Code: #include <stdio.h>
int main() {
}
To do this we use the char* variable Code: char name[1024]; Now we need to have some user interaction. Lets make the application ask for the users name Code: printf("Please enter your name!\n");
The scanf function should look like this Code: scanf("%s", name);
Now we should make the application do a greeting. To make it greet simply print a message using the variable. To print the variable we need to use %s and define what it is at the end. to do this add the following line. Code: printf("Hello %s congradulations on your C Application\n", name);
The final code should be similar to bellow Code: #include <stdio.h>
int main() {
char name[1024];
printf("Please enter your name below!\n");
scanf("%s", name);
printf("Hello %s Congrats on the C app\n", name);
return 0;
}
__________________ |
| | |
![]() |
| Tags |
| input, user, variables |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Random Strings from Variables (PHP) | ap0091 | Programming | 3 | 09-19-2008 08:55 PM |
| Pepsi Code Input Bot | TheFalconer | General Discussion of Networks/Survey Sites | 13 | 05-27-2008 06:13 PM |
| Working on Tattoo Design (need input) | TexasBabe | Chit Chat | 18 | 05-02-2008 01:58 PM |
| AHK Input question | kad77 | Programming | 5 | 01-10-2008 10:40 PM |