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,...
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. ===========================================================...
Can anyone help me with my C++ assignment on structs, arrays and bubblesort? I can't seem to get my code to work. The output should have the AVEPPG from highest to lowest (sorted by bubbesort). The output of my code is messed up. Please help me, thanks. Here's the input.txt: Mary 15 10.5 Joseph 32 6.2 Jack 72 8.1 Vince 83 4.2 Elizabeth 41 7.5 The output should be: NAME UNIFORM# AVEPPG Mary 15 10.50 Jack 72 8.10 Elizabeth 41 7.50 Joseph 32 6.20 Vince 83 4.20 My Code: #include <iostream>...
C++ Object Oriented assignment Can you please check the program written below if it has appropriately fulfilled the instructions provided below. Please do the necessary change that this program may need. I am expecting to get a full credit for this assignment so put your effort to correct and help the program have the most efficient algorithm within the scope of the instruction given. INSTRUCTIONS Create a fraction class and add your Name to the name fraction and use this...