fojtasd

Untitled

Oct 25th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string input;
  8. cout << "Zadej cislo ve dvojkove soustave:" << endl;
  9.  
  10. cin >> input;
  11.  
  12. // go through input string from left to right
  13. for(int i = 0; i < input.size(); i++) {
  14. char ch = input[i];
  15.  
  16. if(ch != '0' && ch != '1') {
  17. cout << "Nespravny vstup." << endl;
  18.  
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment