WHat is wrong with this pound to dollar converter??
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){//this is a dollar to pound converter!
float pound;
float dollar = pound * 1.55;
cout << "Type in your amount of money and I will show you\n how much it is in dollars! ";
cin >> pound;
cout << "You entered: " << pound << "\n and this is: " << dollar << " in dollars!";
return 0;
}
1. Do not mix iostream and stdio.h. Use one or the other (Probably iostream since you are using cin/cout).
2. dollar = pound * 1.55 does not define dollar. Instead, it is an immediate calculation. Calculate the number of dollar after cin >> pound;, not before. With your code as it is, pound will receive the user input but dollar will hold some junk value.
3. Float is not that accurate. Get used to working with double.
4. Use code tags please. There is a button to the side that looks like two angle brackets (<>).