Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Need help with writing a program [c++]
New Posts  All Forums:Forum Nav:

Need help with writing a program [c++]

post #1 of 2
Thread Starter 
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.
Edited by killer625 - 1/9/11 at 11:22am
m0nst4r
(15 items)
 
  
CPUMotherboardGraphicsRAM
Xeon X5660 @ 3,8ghz, 1,2Vcore Gigabyte GA-X58-UD4P gigabyte 460gtx oc2 3x2 GB Kingston 1600mhz @1,5V 
Hard DriveHard DriveCoolingOS
Samsung Dysk Samsung F3 HD103SJ 1TB 7200 Kingston SSD 120GB Cooler Master Hyper TX2 Windows 7 64bit 
MonitorPowerCase
LG W2243S-PF 22" Corsair RM650x SilentiumPC Pax M70 Pure Black 
  hide details  
Reply
m0nst4r
(15 items)
 
  
CPUMotherboardGraphicsRAM
Xeon X5660 @ 3,8ghz, 1,2Vcore Gigabyte GA-X58-UD4P gigabyte 460gtx oc2 3x2 GB Kingston 1600mhz @1,5V 
Hard DriveHard DriveCoolingOS
Samsung Dysk Samsung F3 HD103SJ 1TB 7200 Kingston SSD 120GB Cooler Master Hyper TX2 Windows 7 64bit 
MonitorPowerCase
LG W2243S-PF 22" Corsair RM650x SilentiumPC Pax M70 Pure Black 
  hide details  
Reply
post #2 of 2
pretty easy tbh. have some variables for the sizes and then print out the object using ascii characters like '-','/','+' etc.. like this:
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;
}
}
Pepe Silvia
(13 items)
 
  
CPUMotherboardGraphicsRAM
255 @ 4 Ghz MSI 870-C45 GT 520 @ 1Ghz Crucial Rendition 4GB DDR3 
Hard DriveOSMonitorPower
Hitachi 1TB Win 7 19" 420W 
  hide details  
Reply
Pepe Silvia
(13 items)
 
  
CPUMotherboardGraphicsRAM
255 @ 4 Ghz MSI 870-C45 GT 520 @ 1Ghz Crucial Rendition 4GB DDR3 
Hard DriveOSMonitorPower
Hitachi 1TB Win 7 19" 420W 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Need help with writing a program [c++]