|
-
Jan 9th, 2001, 06:18 PM
#1
Thread Starter
Fanatic Member
What is wqrong with the following code, it works but I get two error when compiling.
// ws2.cpp : Defines the entry point for the console application.
//
//include header files
#include "stdafx.h"
#include "stdio.h"
int main(void)
{
//declare variables
int status;
float i;
char y;
//set y = to y
y=y;
//start while loop, only while = y
while(y)
{
//use common printf function
printf("Please enter the number of Pounds: ");
//scan the amount entered
scanf("%f",&i);
//calculate and display the amount
printf("The amount of Dollars is: %.2f\n ", i*1.5);
//ask of they want to continue
printf("Do you want to continue?(Y/N)");
//get input
scanf("%c",&y);
y=getchar();
//if anything but y, stop function
if (y!='y')break;
}
return 0;
}
Also if I want to check to make sure that they have input a number when asked about how many pounds they want to convert, how would I do that?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|