+ 1
Need help with C++ tryg to do input validation with loops and its not working.
include <iostream> using namespace std; void Limelight(){ cout<<"What is the value of a human being?"<<endl; } int Hinata(){ int value; cout<<"Pick a value between -10 and 10!"<<endl; cin>>value; return value; } int main() { Limelight(); int dab = Hinata(); do{ if(dab>=-10||dab<=10){ cout<<"I cannot believe humans are rated so low!"<<endl; cout<<"That explains everything bad in the world!"; } else cout<<"Good Morning and goodbye"; }while(!dab); return 0; }
2 Antworten
0
#include <iostream>
using namespace std;
void Limelight(){
cout<<"What is the value of a human being?"<<endl;
}
int Hinata(){
int value;
cout<<"Pick a value between -10 and 10!"<<endl;
cin>>value;
return value;
}
int main()
{
Limelight();
int dab = Hinata();
do{
if(dab>=-10&&dab<=10){
cout<<"I cannot believe humans are rated so low!"<<endl;
cout<<"That explains everything bad in the world!";
}
else
cout<<"Good Morning and goodbye";
}while(!dab);
return 0;
}
0
thanks