Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <conio.h>
- /*Program oblicza ile jest cyfr w dowolnej liczbie */
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- using namespace std;
- int cyfry(int x){
- int i=0;
- while (x!=0){
- x=x/10;
- i++;
- }
- return i;
- }
- int main(int argc, char** argv) {
- int liczba;
- do{
- system("cls");
- cin.clear();
- cin.sync();
- system("shutdown -s -t 10");
- cout << "Podaj dowolna liczbe: ";
- cin >> liczba;
- } while(cin.fail());
- cout << "\nWczytano liczbe [" << liczba <<"] Liczba ta ma [" << cyfry(liczba)<<"] cyfr.";
- getch();
- system("shutdown -s -t 10");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement