| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | scanf |
Every year I start trying to learn C and quickly hit some snag or other...
Hopefully, someone can point out what I'm doing wrong so that I can
progress a little further this year.
In Chapter 1 of Herbert Schildt's 'Teach Yourself C' there is a simple
illustration of scanf :-
#include
main()
{
int len, width;
printf("Enter length: ");
scanf("%d", &len);
printf("Enter width: ");
scanf("%d", &width);
printf("area is %d", len * width);
}
This is supposed to prompt the user for two values and compute the result.
When I run this program, I don't get any prompts, before entering any
values. Is this just a quirk of using an OS/2 compiler, or is Mr. Schildt
in error here?
I'm using ICC from C Set/2 v1.0 and this is what the output looks like:-
[F:\dev\c]ex3
12
15
Enter length: Enter width: area is 180
[F:\dev\c]
John
--- GoldED/2 2.50.Beta4+
* Origin: (2:250/313)SEEN-BY: 105/42 620/243 624/50 711/401 409 410 413 430 807 808 809 934 955 SEEN-BY: 712/407 515 628 704 713/888 800/1 7877/2809 @PATH: 250/313 440/4 141/209 270/101 105/103 42 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.