C++ Primer(第5版) 练习 4.11
练习 4.11 书写一条表达式用于测试4个值a、b、c、d的关系,确保a大于b、b大于c、c大于d。
环境:Linux Ubuntu(云服务器)
工具:vim
代码块
/*************************************************************************
> File Name: ex4.11.cpp
> Author:
> Mail:
> Created Time: Fri 02 Feb 2024 03:48:46 PM CST
************************************************************************/
#include<iostream>
using namespace std;
int main(){
int a, b, c, d;
cout<<"Enter a, b, c, d: ";
cin>>a>>b>>c>>d;
while((a <= b) || (b <= c) || (c <= d)){
cout<<"False. Retry!\nEnter a, b, c, d: ";
cin>>a>>b>>c>>d;
}
cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
return 0;
}