yamoo
08-18-2005, 03:59 PM
On this code:
#include <stdio.h>
int
main(void)
{
char letter_1, letter_2, letter_3;
int year;
printf("Enter a three letter name and press enter> \n");
scanf("%c%c%c", &letter_1, &letter_2, &letter_3);
printf("please enter the year \n");
scanf("%d", &year);
printf("Hi, %c%c%c. %d is is a great year to study \n");
system("PAUSE");
return 0;
}
I run it, enter a three letter name, such as bob, with the year, such as 2005, and it returns this:
Hi pvu. 2009315348 is is a great year to study.
Why doesn't it return the year or name I entered?
I'm using Bloodshed 4.9.9.2 beta.
So, who's fault is it? Mine or the compiler? (I just started C yesterday, so I don't know...)
I included the exe file in the zip below.
So you can run it on your own machine.
#include <stdio.h>
int
main(void)
{
char letter_1, letter_2, letter_3;
int year;
printf("Enter a three letter name and press enter> \n");
scanf("%c%c%c", &letter_1, &letter_2, &letter_3);
printf("please enter the year \n");
scanf("%d", &year);
printf("Hi, %c%c%c. %d is is a great year to study \n");
system("PAUSE");
return 0;
}
I run it, enter a three letter name, such as bob, with the year, such as 2005, and it returns this:
Hi pvu. 2009315348 is is a great year to study.
Why doesn't it return the year or name I entered?
I'm using Bloodshed 4.9.9.2 beta.
So, who's fault is it? Mine or the compiler? (I just started C yesterday, so I don't know...)
I included the exe file in the zip below.
So you can run it on your own machine.