1.简单的输入输出代码示例:
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
int x;
float y;
cout << "please input an int number:" << endl;
cin >> x;
cout << "The int number is X = " << x << endl;
cout << "please input a float number:" << endl;
cin >> y;
cout << "The float number is y = " << y << endl;
system("pause");
return 0;
}
2.cin连续输入示例:
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
int x;
float y;
cout << "please input an int number and a float number:" << endl;
cin >> x >> y;
cout << "The int number is x =" << x << endl;
cout << "The float number is y =" << y << endl;
system("pause");
return 0;
}