Help plz!!

I would like to output an array on seating plan with input no of student, rows, seats per rows,,
but the array is not working !!

as there is one row for all student,

for the 1st student will be 1, then there is a empty seat "-1",
after that it will be the 2nd student.



for (j=0;j<=seat;j++)
{
if (j%2==0)
{


cout<<Seating[j];
}
else
{



cout<<"-1";

}
}
}

is there anyone could help plz!!
Last edited on
a one dimensional array is not what you need... a little pseudo code for you to maul over...


1
2
3
4
5
6
7
8
9
10
11
int seat [student] [seat_number];   a two dimensional will work better I think

for (j=0;j<=seat;j++){
if (j is not right) {
do something to fix it here
}
else{
seat_number=j;

cout << seat[ student #0] [seat_number];
}
}

Something like that
Last edited on
what if I need to place "0" as the empty seat between two students?

btw thanks.
You're welcome.

You have 8 steps.

1. The program should read three numbers .
2. The first number is the number of students, the number of rows and the number of seats in a row ( same for every row ).
3. There will be one empty seat between every two neighboring students on the same row or on the same column.
4. After user input the number of student, rows and seats in a row, the program should compute and print out the maximum number of students that the classroom can support.
5. The program will stop immediately if the number of student provided by the user is larger than the maximum value. Otherwise, The program should also print out the seating plan row by row on the screen.
6. If a seat is taken by a student, it will simply print out his/her student ID. Otherwise, -1 will be printed.
7. This project assumes that the student IDs are 1000001 for the first student, 1000002 for the second......
8. The width of output is set to 10 .

You have 8 steps.

Steps 1 and 2....

How would you accomplish this?
for step 1 n 2

I will
cin>> number of students>> the number of rows >> the number of seats ;


how about step 4 and step 3 reverse??
Topic archived. No new replies allowed.