I need to make a table made of 4 rows and 11 columns. The first column has the numbers 1, 2, 3, and 4, the rest of the columns contain the results of multiplying the number in the first column by the numbers 0 through nine. It should look something like this:
Have the first for loop to be x=1;x<=4;x++ and the other loop, say, int y, be 0 to 9.
cout the x and a space. Then in the y loop, cout x*y and a space.
After the y loop, cout a newline with endl or '\n'.
Yeah, I could, but I would rather see what you write first. I gave you everything you need to write it. I wrote it already, and it was only 5 lines long, not counting the braces '{' and '}'. I'll help you through the programming, not over it.
The variables are anything you want to name them. You can use the int x and int y, if you want, or you could call them int column and int row. Names are just place-holders in memory for the values.
//for(Integer representing rows;how many rows?;what do you add to reach the next row?){
//this is a NESTED for(integer representing columns;how many columns?;how do you reach the next column?){
// this code here representing the code for the 1st row, it will run through the desired columns
//and end, starting up the first for loop again which moves down one row
//}
//}
if you want to print out the table and say, you made the two for loop ints 'Rows' and 'Cols'
then you would write std::cout << Array[Rows][Cols] in the middle, and std::cout << std::endl; after the nested for loop(but still inside the main loop). Is that what you were asking?
A lot of programmers dislike using system calls, as they may not work properly on ALL systems, but for your first or second program, I think it's okay to do. After that, try finding better solutions on pausing the program.
Have you almost finished writing the program yet? Would love to see it.
@toradow777, you are definitely in the same boat that I was in a few hours ago. Unfortunately I had to give up on the assignment. Intermediate22.cpp Yeah, I've been struggling since chapters 3 & 4 and barely making it by. Now I'm completely lost. I guess I will be taking this course all over again next semester.
ProWorks, why dont you post threads asking for help here? The people here would love to help a struggling student with his homework, provided he put the effort in.
I would have loved to post up threads about my concerns for this course. But I only stumbled across this site hours ago and registered. But I believe with only a few weeks left in this semester, I'm afraid it is a little too late. I've been struggling in this course since chapt. 3 and 4, but managed to wing it and make it by. Now I'm to the point where I'm totally lost.