Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * Solution to homework assignment 1
- * Introduction to programming course
- * Faculty of Mathematics and Informatics of Sofia University
- * Winter semester 2019/2020
- *
- * @author <Velislava Petkova>
- * @idnumber <62428>
- * @task <4>
- * @compiler <VC>
- *
- */
- #include <iostream>
- #include <cmath>
- #include <stdlib.h>
- using namespace std;
- int main()
- {
- system("COLOR 3");
- int myNumber = 0;
- cout << "Input a number to start the countdown: ";
- cin >> myNumber;
- system("cls"); //Clears the screen after our input
- if (!cin)
- {
- cout << "It is not an accurate number " << endl; //Checks if the input is correct
- return 1;
- }
- else if (myNumber<1 || myNumber > pow(2, 16) - 1)
- {
- cout << "It is not an accurate number " << endl;
- return 1;
- }
- else
- {
- while (myNumber >= 0)
- {
- cout << myNumber; //Displays our number
- long long help = 0;
- do
- {
- help += 2; //A loop to help slowing down the operation
- help -= 1;
- } while (help <= 300000000);
- myNumber--; //We reduce the number by 1, we clear the screen and display the new number
- system("cls");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement