我是一個C++新手,並遇到第一個程序出現問題。我試圖乘以兩個浮點數,結果總是顯示爲1.1111e + 1,其中1是隨機數。以下是我寫的小程序。乘以C++中的兩個浮點數給我非數字結果
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
int main()
{
float bank;
float dollor;
cout<<"Enter amount of $ deposited at Bank: ";//the data to input is 5000
cin>>bank;
cout<<"Enter current $ price: ";//1usd = 800mmk: the data to input is 800
cin>>dollor;
bank*=dollor;//all deposited $ to local currency
cout<<"Result is "<<bank;
getch();
}
,並將該軟件的結果是圖4e + 006。
ps:我聲明爲float,以便有時輸入花車。 請幫我在這個程序,我錯了。謝謝大家..
-1:看起來像是對我的正確答案。 – 2011-12-16 13:38:35