我只想快速提示如何做到这一点让我走上正轨。顺便说一句,我是编程新手,所以一些解释会很受欢迎。
所以它基本上是这样的:用户输入由空格分隔的4个数字,程序会在它们之间输入小于的数字。
例如:
input 1:
2 4 6 6
output 1:
2<4<6=6
input 2:
5 5 1 5
output 2:
5=5>1<5
答案 0 :(得分:2)
// create variables to store the numbers
int first, second;
// read in the first numbers
cin >> first;
// output the first number
cout << first;
// loop through the numbers as they are inputed
while(cin >> second) {
// check all the possibilities
if(first < second) cout << "<";
else if(first > second) cout << ">";
else cout << "=";
cout << second;
first = second;
// go back around again
}