Mail Archives: djgpp/1997/01/31/23:25:47
From: | matrix AT ionsys DOT com (MCheu)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Help scanf?
|
Date: | Sat, 01 Feb 1997 01:58:08 GMT
|
Organization: | Infinity online
|
Lines: | 36
|
Message-ID: | <32f2a072.17736424@news.ionsys.com>
|
NNTP-Posting-Host: | ip-015.ionsys.com
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
#include <stdio.h>
main()
{
/* Declare */
double a, b, c
/* Grab Input */
printf("Please enter your information in the following
format\n");
printf("a(9999.99) b(9999.99) c (9999.99)\n");
scanf("%f",&a);
scanf("%f",&b);
scanf("%f",&c);
/*Display abc */
printf (" a : %7.2f\n",a);
printf (" b : %7.2f\n",b);
printf (" c : %7.2f\n",c);
return 0;
}
Could someone please tell me why all input entered comes back out as
0000.00? The original listing from class notes has a, b and c
delcared as ints and the edit masks as %d. That version, when typed
in works as it should. My version with floating point numbers
doesn't. What am I doing wrong?
Thanks
Michael Cheu
-matrix AT ionsys DOT com
- Raw text -