Return Styles: Pseud0ch, Terminal, Valhalla, Blue Moon. Entire thread

Learning sepples

Name: Anonymous 2017-10-10 23:14

Hey, /prog/.
I'm a C programmer trying to learn sepples.
Can anybody tell me what is happening in this code?
Why does it go into infinite loop mode if I give a non-integer and how to defend against this?

#include<iostream>
using namespace::std;

int main(){
while(true){
//Why does this sperg out if I put a bad integer in?
int answer = -1;
cin >> answer;
cout << answer << "\n";
}
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List