Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Infrastructure For Medical Research In Databases

Authors: Thomas Heinis ,Anastasia Ailamaki

1st Edition

1680833480, 978-1680833485

More Books

Students also viewed these Databases questions

Question

Verilog code and testbench needed for apb slave (no handwritten).

Answered: 1 week ago

Question

3. Contrast relational contexts in organizations

Answered: 1 week ago

Question

2. Describe ways in which organizational culture is communicated

Answered: 1 week ago

Question

1. Describe and compare approaches to managing an organization

Answered: 1 week ago