Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // base code file
- #include <iostream>
- #include <windows.h>
- #include <stdlib.h>
- #include <time.h>
- #include <conio.h>
- #include <sstream>
- #include <fstream>
- using namespace std;
- void gotoxy(short x, short y) {
- COORD pos = {x, y};
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
- }
- // generates a random number between 0 and r inclusive
- int random(int r)
- {
- return rand()% r + 1;
- }
- ///////////////////////////////////////////////////////////////////////
- main()
- {
- srand(time(NULL));
- // write code here
- // leave the following line in all programs
- while(true){
- int randum = rand() % 100 + 1;
- cout<<"#######"<<endl;
- cout<<"# #"<<endl;
- cout<<"# #"<<endl;
- cout<<"# #"<<endl;
- cout<<"# #"<<endl;
- cout<<"#######"<<endl;
- gotoxy(3,2);
- cout<<randum;
- gotoxy(0,7);
- cout<<"Please enter q to quit. Any other chracter will allow you to continue:";
- char quit = getch();
- gotoxy(0,0);
- if(quit=='q'){
- break;
- }
- }
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement