基本输入输出之从键盘读取数据
/*从键盘读取数据
1.使用cin对象从键盘输入数据
2.提示输入*/
#include<iostream>
#include<iomanip>
usingnamespace std;
int main()
{
double income,expense;
int month;
cout<<"What month is it?"<<endl;
cin>>month;
cout<<"You have entered the month="<<month<<endl;
cout<<"Please enter your income and expenses"<<endl;
cin>>income>>expense;
cout<<setprecision(2)
<<setiosflags(ios::fixed|ios::showpoint)
<<"Entered income=$"<<income
<<",expenses=$"<<expense<<endl;
return0;
}

浙公网安备 33010602011771号