void rowout (int columns)
{
int x(1);
while (x <= columns)
{
cout<<"*";
x += 1;
}
cout<<endl;
return;
}
This should print out a row of *s dependent on how many columns the user wants.
Now, back in the main function, I have another while loop that will tell how many times to makes these columns (it is the row loop and will make that line for how ever many rows)
Now, I'm trying to call this void function within the int main () while loop. I've tried putting cout<<rowout; but it gives me some hex stuff, and I can't figure out how to correctly invoke it.
int /*(or void)*/ main(){
int x=0,rows,columns;
cout<<"How many rows do you want?";
cin>>rows;
cout<<"How many columns do you want?";
cin>>columns;
while(x<rows){
rowout(columns);
x++;
}
return 0; //if you so please
}
edit: forgot a ";" and I guess you don't need the "cout<<endl;" in the main if you have it in the rowout() already
edit 2- I forgot to add an "x++ in the loop" (stupid me)
__________________
To fry or not to fry...oh what the heck, let it fry :)
Last edited by lost-and-found; 02-11-2004 at 09:55 PM.
do you mean like: "cout<<rowout(columns);"? well when you have the cout, it is expected that rowout() returns something then. That's why it gave you hex since there was nothing being returned. when you just have "rowout(columns);" the program knows all the work is done in the function rowout() and the program is not expecting rowout() to return any value.
__________________
To fry or not to fry...oh what the heck, let it fry :)