Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string input;
- cout << "Zadej cislo ve dvojkove soustave:" << endl;
- cin >> input;
- // go through input string from left to right
- for(int i = 0; i < input.size(); i++) {
- char ch = input[i];
- if(ch != '0' && ch != '1') {
- cout << "Nespravny vstup." << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment