基本输入输出之从键盘读取数据

/*从键盘读取数据
  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;
}
posted @ 2012-06-22 10:49  蚂蚁踩死了大象  阅读(197)  评论(0)    收藏  举报