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
- cout<<"Please enter a symbol:";
- char sym;
- cin>>sym;
- cout<<"Please enter the width:";
- int wid;
- cin>>wid;
- cout<<"Please enter the height:";
- int height;
- cin>>height;
- cout<<"Please enter a x-coordinate:";
- int cord;
- cin>>cord;
- cout<<"Please enter a y-coordinate:";
- int cord2;
- cin>>cord2;
- gotoxy(cord,cord2-2);
- for(int counter=0;counter<height;counter++){
- cout<<endl;
- gotoxy(cord,cord2+3-counter);
- cout<<sym;
- for(int counter=0;counter<wid-1;counter++){
- cout<<sym;
- }
- }
- // leave the following line in all programs
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement