void functions

I've been working on this rocket program for a little while. I've seen that another person has posted the same assignment and the complete program has been provided in response but I really am trying to do the coding on my own. If anyone can tell me what is wrong with the program I have provided I would greatly appreciate it!
#include<iostream>
using namespace std;
//sample function prototypes
void drawCone(/*in*/int);
void drawEvenBox(/*in*/int,/*in*/int); 
void drawOddBox(/*in*/int,/*in*/int); 
void get Dimensions (/*out*/int&,/*out*/int&, /*out*/int);  
void drawRocket (/*in*/int,/*in*/int, /*in*/int); 


int main()
{

   int height=0,width=0;stages=0;
   getDimensions (height,width,stages); 
   drawRocket (height,width,stages);

return 0;
}


void get Dimensions (/*out*/int& height,/*out*/int& width ,/*out*/int stages);

{cout<<"Please enter two whole number variables to represent height and width of the rocket generated.";
cin>>height>>width>>stages;
}


void drawRocket (/*in*/int height,/*in*/int width , /*in*/int stages)
{
drawCone
if(height%2!=0)
{drawOddBox(width,height)}
else
{drawEvenBox(width,height,stages)}
drawCone
     
}
void drawCone(/*in*/int width)
{
     int spaceCount=0;
int rowSpace=0,symbolCount=0;

while (rowc<=height/2)//as long as the row you are constructing is less than the heighest row or the highest row
{spaceCount=rowc;//the number of spaces before the first symbol is equal to the row number we are on starting with 0
while (spaceCount<(height/2))//as long as the number of spaces is less than the highest row we out put a blank space and add one for each loop
{
cout<<" ";
spaceCount++;
}
symbolCount=0;
rowSpace=width-rowc;
while(symbolCount<=(width-(rowSpace-rowc)))
{
cout<<"X";
while (rowSpace<width+rowc-1)
{
cout<<" ";
rowSpace++;
}
symbolCount++;
}
cout<<endl;
rowc++;
}
}
void drawEvenBox(/*in*/int height,/*in*/int width);
{
 for (int row = 1; row <= height; row++)
{
for (int col = 1; col <= width; col++)
{
if (row > 1 && row < height && col > 1 && col < width)
cout << " ";
else
cout << "*";
}
cout<<endl;
}
}
void drawOddBox(/*in*/int height,/*in*/int width);
{
  while (row<height)
{col=0;

while(col<width)
{cout<<"X";
col++;
}
cout<<endl;
row++;

}
}
Last edited on
1) Please use code tags when posting code, to make it readable:

http://www.cplusplus.com/articles/z13hAqkS/

2)
tell me what is wrong with the program I have provided


What makes you think there's anything wrong with it?
When I try to run the program there is always an error. I can't find any logical errors or even syntax errors but the program shows errors on the prototype for the evenbox,oddbox and drawrocket function
sbsheena

Please use code tags when posting; it is almost unreadable without. Also, add some spaces and indentation.

Your code comes nowhere close to compiling. "No syntax errors" is not true.

Please fix the following and then repost your code:
- remove the /* */ placeholders in your function prototypes and function declarations; they are just confusing;
- do not put spaces in the middle of function names (get Dimensions ... twice)
- function prototypes need ; at the end of the line, whilst function declarations DON'T; check and fix ALL of these
- for every function that you use, check that the number of arguments in the prototype matches that in the function declaration and every point of use; drawcone without ANY arguments is clearly wrong, but there are problems with other functions
- getDimensions won't return a value of stages unless you indicate a reference - thus &stages ... do this in prototype and declaration
- variables like rowc haven't been initialised in drawcone
- variables like row and col haven't been declared as int in drawOddBox ... your compiler would tell you this


Please make all these changes and add spaces and indentation where appropriate before reposting code.
Last edited on
my bad I realize had had posted an earlier draft of the program ill make the code tags and put up the newest draft
Topic archived. No new replies allowed.