Question: C++ Write a program that randomly moves a student from one seat to another seat in a lecture hall, perhaps to randomly move students before

C++

Write a program that randomly moves a student from one seat to another seat in a lecture hall, perhaps to randomly move students before an exam. The seats are in 20 rows numbered 1 to 20. Each row has 30 seats (columns) numbered 1 to 30. The student should be moved from the left side (columns 1 to 15) to the right side (columns 16 to 30). Given an input of row number and column number, the program should randomly allocate the student in a spot on the right. The program should output the old and new row and column number. This program does not use arrays or loops

Here is a starter template for you:

#include #include #include using namespace std;

// Switch a student // from a random seat on the left (cols 1 to 15) // to a random seat on the right (cols 16 to 30) // Seat rows are 1 to 20

int main() { int rowNumL; //row number on the left int colNumL; //column number on the left int rowNumR; // row number on the right int colNumR; // colum number on the right

// your code goes in here

cout << "Move from "; cout << "row " << rowNumL << " col " << colNumL; cout << " to " ; cout << "row " << rowNumR << " col " << colNumR; cout << endl;

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!