Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int vstup;
- unsigned long cislo,ofcheck;
- void inputcheck()
- {
- if(vstup != 10 && vstup < 48 || vstup > 57)
- {
- printf("wrong input!");
- }
- }
- //4,294,967,295
- //2,147,483,647 4294967295
- int input()
- {
- cislo = 0;
- do {
- vstup=getchar();
- inputcheck();
- if(vstup != 10){
- ofcheck==cislo;
- overflowcheck();
- cislo=cislo * 10 + (vstup - 48);
- }
- } while (vstup != 10);
- printf("%lu\n",cislo);
- return cislo;
- }
- void overflowcheck()
- {
- if((cislo - (vstup - 48)) / 10 != ofcheck)
- {printf("overflow");}
- }
Add Comment
Please, Sign In to add comment