I need to print a rectangle for a game.
The user enters 2 values, say 3 and 5
out put:
*****
* *
*****
Can this be done without anything complicated (i.e without pointers and arrays etc..)
any suggestions?
I need to print a rectangle for a game.
The user enters 2 values, say 3 and 5
out put:
*****
* *
*****
Can this be done without anything complicated (i.e without pointers and arrays etc..)
any suggestions?
graphic or just text?
Just text
its just supposed to be a hollow square made up of #.
Does anyone know the algorithm?
thanks
heres some code
Code:cin>>x>>y; //x=3,y=5 for(col=1;col<=y;col++) { gotoxy(col,1); cout<<"#"; gotoxy(col,x); cout<<"#"; } for(row=2;row<x;row++) { gotoxy(1,row); cout<<"#"; gotoxy(y,row); cout<<"#"; }
-
hey man thats justr borland code u should tell him that also
here is some code hope u can fix the rest your self
***************************************
#include <iostream.h>
#include <stdlib.h>
#include<iomanip.h>
main()
{
int t;
int y;
cin>>y;
cin>>t;
for(int q=0;q<=y;q++)
{
cout<<"*\n";
for(int e=0+2;e<=t;e++)
{
cout<<"*";
}
}
system("pause");
return 0;
}
Simple:
Sorry, I hate scanf.Code:#include <iostream.h> #include <stdio.h> int main(void) { int x,y; printf("Enter Width: "); cin >> x; printf("Enter Height: "); cin >> y; for(int n=0; n<y; n++) { for(int h=0; h<x; h++) { printf("*"); } printf("\n"); } return(0); }
^^that was me.^^
just thought i should let ya know. make it look like im special or somthing...
..nevermind