多项输入

 1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6         //输入输出字符
 7     char c;
 8     cin>>c;
 9     cout<<"c="<<c<<endl;
10 
11     //输入输出整型数据
12     int n;
13     cin>>n;
14     cout<<"n="<<n<<endl;
15 
16     //输入输出浮点型数据
17     double x;
18     cin>>x;
19     cout<<"x="<<x<<endl; 
20 
21     //输入提示
22     cout<<"n=";
23     cin>>n;
24     cout<<"n="<<n<<endl;
25 
26     //多项输入
27     cout<<"c n x"<<endl;
28     cin>>c>>n>>x;
29     cout<<"c="<<c<<" n="<<n<<" x="<<x<<endl;
30     return 0;
31 }

 

posted @ 2018-08-02 10:29  Borter  阅读(140)  评论(0)    收藏  举报