42.To learn how nested for loops work, do a walk-through of the fol-lowing program segments and determine, in each case, the exact out-put. (4, 7)
A)
int i, j;for (i = 1; i <= 5; i++) { for (j = 1; j <= 5; j++) cout << setw(3) << i; cout << endl;}
B)
int i, j; for (i = 1; i <= 5; i++) { for (j = (i 1 1); j <= 5; j++) cout << setw(5) << j; cout << endl; }
C)
int i, j; for (i = 1; i <= 5; i++) {for (j = 1; j <= i; j++) cout << setw(3) << j; cout << endl; }
D)
const int M = 10;const int N = 10;int i, j; for (i = 1; i <= M; i++){for (j = 1; j <= N; j++) cout << setw(3) << M * (i - 1) + j; cout << endl; }
42.To learn how nested for loops work, do a walk-through of the fol-lowing program segments and...
Right now, program pushes all data to screen in three loops need to prompt user for three text files, and need to push data from each loop into those three text files. #include #include #include #include #include #include #include #include using namespace std; double random(double minprice, double maxprice); string printRandomString(int n); bool coinToss(); int clicks(); int runme(); int createfiles(); struct things{ //things(); int id; string name; string category; double price; bool two_day_shipping; int...
Can somebody help me with this coding the program allow 2 players play tic Tac Toe. however, mine does not take a turn. after player 1 input the tow and column the program eliminated. I want this program run until find a winner. also can somebody add function 1 player vs computer mode as well? Thanks! >>>>>>>>>>>>>Main program >>>>>>>>>>>>>>>>>>>>>>> #include "myheader.h" int main() { const int NUM_ROWS = 3; const int NUM_COLS = 3; // Variables bool again; bool won;...
What is the output from each of the following segments of C++ code? Record the output after the “Answer” prompt at the end of each program fragment. Assume all variables have been suitably declared. (Each problem is worth 3 points.) 1. for (int j = 25; j > 16; j -= 3) cout << setw(5) << j; Answer: 2. int sum = 0; for (int k = -2; k <= 2; k++) sum = sum +...
howthe output of the following 4 program segments (a) const int SIZE=8; int values[SIZE] = {10, 10, 14, 16, 6, 25, 5, 8}; int index; index=0; res = values[index]; for (int j=1; j<SIZE; j++) { if (values[j] > res) { res = values[j]; index = j; cout << index << res << endl; } } cout <<...
How can I make this compatible with older C++ compilers that DO NOT make use of stoi and to_string? //Booking system #include <iostream> #include <iomanip> #include <string> using namespace std; string welcome(); void print_seats(string flight[]); void populate_seats(); bool validate_flight(string a); bool validate_seat(string a, int b); bool validate_book(string a); void print_ticket(string passenger[], int i); string flights [5][52]; string passengers [4][250]; int main(){ string seat, flight, book = "y"; int int_flight, p = 0, j = 0; int seat_number,...
Examine each of the following program segments carefully. Determine what is printed from each program. There are no intentional errors. 1. int array[] = {1, 2, 3, 4, 5}; for (int i = 0; i < 5; i++) cout << array[i]*5 << “ “; Output _________________________________ 2. int *iptr; iptr = new int[5]; for (int count = 0; count < 5; count++) iptr[count] = count+1; cout << *iptr << endl; Output _________________________________ 3. int x = 50, y = 60,...
Can I get help with adding the following to this code please? 1. When buying multiple tickets, if one of the seats selected is already taken, give a message like "Sorry, one or more of the seats selected is already taken." and prompt the user to select the seats all over. (Or if possible to make it suggest a location where the seats are together that the user can select instead) 2. Print the total cost after all of the...
Expand the payroll program to combine two sorting techniques
(Selection and Exchange sorts) for better efficiency in sorting the
employee’s net pay.
//I need to use an EXSEL sort in order to
combine the selection and Exchange sorts for my program. I
currently have a selection sort in there. Please help me with
replacing this with the EXSEL sort.
//My input files:
//My current code with the sel sort. Please help me replace this
with an EXSEL sort.
#include <fstream>...
1. in this programe i want add some products to be shown after choosing choise ( show all products ) before i add any products. let say 10 products have added to the program then when the user choose (show all products ) all the 10 products appear and the user going to choose one and that one must has its own name, price,and quantity after that the quantity will be reduce. 2. allow the user to buy products. ===========================================================...
I am trying to modify this program so that it stores the employee's name in a c-string and can handle up to 100 employees (so it would mostly be a partially filled array), but I cannot get it to work. It works with two files that it is suppose to read input from. Then it prints output to an output file. Employee Info File (first file read, M/F should be ignored): 5 Christine Kim 30.00 2 1 F 15 Ray...