0

#include <iostream> using namespace std; int main(){ float a,b; for(int i=1;i<1000;++i){ cin>>a; cin>>b; flo

someone please make a an exception for me so that one can't enter strings or characters

10th Dec 2017, 4:20 PM
Ian
Ian - avatar
1 Answer
0
You already can't add strings or characters. When cin encounters a character/string, it stops parsing the input. So if you input 7.15Kg, cin will stop parsing at 'K', leaving you with 7.15. Here is an example https://code.sololearn.com/c9pY1Gx0Iz1y/#cpp
10th Dec 2017, 9:24 PM
Cailyn Baksh