Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <cstdio>
- using namespace std;
- //loops - exercises
- main()
- {
- beginning:
- system("cls");
- int var1;
- int nrOfDigits = 1;
- cout << "Input number: " << endl;
- cin >> var1;
- int tmp = var1;
- while(tmp /= 10)
- nrOfDigits++;
- cout << "The number " << var1 << " has " << nrOfDigits << " digits" << endl;
- char decision;
- cout << "Do you want to try again? (Y/N)" << endl;
- cin >> decision;
- if (decision == 'y' || decision == 'Y')
- goto beginning;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement