Overclock.net banner

1 - 2 of 2 Posts

·
Registered
Joined
·
223 Posts
Discussion Starter · #1 ·
Hey guys, i started programming in my school recently, had just some basic functions like calculator etc so far, yet now my teacher told me that i have to write sth like in the attachment, i got no clue how to even start it as i've never encountered similar thing. I dont how can he expect that we will do it, its impossible with the amount of knowledge we have atm ;/ so im in despair.

http://i56.tinypic.com/2vdjgxg.jpg - screen shot of the exercise.
 

·
Registered
Joined
·
579 Posts
pretty easy tbh. have some variables for the sizes and then print out the object using ascii characters like '-','/','+' etc.. like this:

Code:

Code:
while(1)
{
system("cls");  //clearing the screen
cout << "----------------------" << endl;
for(int i =0; i < size;i++)
{
cout << " ";
}
cout << "/" << endl;
for(int i =0; i < (size-1);i++)
{
cout << " ";
}
cout << "/" << endl;
for(int i =0; i < (size-2);i++)
{
cout << " ";
}
cout << "/" << endl;
//etc...
cin >> choice;
if(choice == '+')
{
size+=size;
}
else if(choice == '-')
{
size-=size;
}
}
 
1 - 2 of 2 Posts
Top