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
- int a;
- int b;
- char c;
- int d;
- int e;
- cout<<"Please enter a width: ";
- cin>>a;
- cout<<"Please enter a height: ";
- cin>>b;
- cout<<"Please enter a symbol: ";
- cin>>c;
- cout<<"Please enter an X coordinate: ";
- cin>>d;
- cout<<"Please enter a Y coordinate: ";
- cin>>e;
- for(int g=0; g<b; g++)
- {
- gotoxy(d,e+5);
- for(int f=0; f<a; f++)
- {
- cout<<c;
- }
- cout<<endl;
- e++;
- }
- for(int g=0; g<b-2; g++)
- {
- gotoxy(d+1,e-b+6);
- for(int f=0; f<a-2; f++)
- {
- cout<<" ";
- }
- cout<<endl;
- e++;
- }
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement