Here is the output
*****
*****
5
4
3
2
1
0
*****
1
2
4
8
*****
4
3
2
1
*****
10 20 30
20 40 60
30 60 90
*****
aggie
aggie
aggie
And the complete code
#include <iostream>
#include <stdlib.h>
#include <iomanip>
using namespace std;
int main() {
cout << "*****" << endl;
int wildcat = 2;
while(wildcat > 5) {
cout << wildcat << endl;
}
cout << "*****" << endl;
int jayhawk = 5;
do {
cout << jayhawk << endl;
} while(jayhawk-- > 0);
cout << "*****" << endl;
int wolverine = 1;
while(wolverine > 0 && wolverine < 10) {
cout << wolverine << endl;
wolverine *=2;
}
cout << "*****" << endl;
for (int zag = 4; zag>0;zag--) {
cout << zag << endl;
}
cout << "*****" << endl;
for (int i=10; i<=30; i+=10) {
for (int j=1;j<=3;j++)
cout << setw(3) << i *j; // setw(n) -> set
width
cout << endl;
}
cout << "*****" << endl;
for (int k=0;k<=5;k++)
if (k ==3) exit(0);
else cout << "aggie" << endl;
cout << "*****" << endl;
return 0;
}
points): Show the output of the code below as it would appear on the monitor. int...
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 +...
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,...
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 <<...
what is the output of the following code segment? C++ g. int arr[3][4]; for (int i = 0; i < 3; i++) for (int j = 0; j < 4; j++) arr[i][j] =i*4 + j; for (int i = 0; i < 3; i++) for (int j = 0; j < 4; j++) cout << arr[i][j] << " "; h. int next(int & x) { x= x + 1; return (x + 1); int main() { int y = 10;...
Explain the output of the following C++ program. #include <iostream> using namespace std; void Magic(int i=1, int j=2,int k=3, double product =1.0) { i+=2; j*=2; k/=2; product=i*j*k; } void Magic(int& i, int& j, double& product) { i+=2; j=j*2+2; product=i*j; } void Magic(int* i,int* j) { double product; *i+=2; *j=*j*2+2; product=*i * *j; } int main() { double product; int i=0,j=0,k=0; product=i*j*k; Magic(); cout<<"i, j, k and product in main () after 1st round:"<<endl<<i<<endl<<j<<endl<<k<<endl<<product<<endl; Magic(2,4); cout<<"i, j, k and...
I need a detailed pseudocode for this code in C ++. Thank you #include <iostream> #include <string> #include <iomanip> using namespace std; struct Drink { string name; double cost; int noOfDrinks; }; void displayMenu(Drink drinks[], int n); int main() { const int size = 5; Drink drinks[size] = { {"Cola", 0.65, 2}, {"Root Beer", 0.70, 1}, {"Grape Soda", 0.75, 5}, {"Lemon-Lime", 0.85, 20}, {"Water", 0.90, 20} }; cout <<...
How many Iterations will this while loop perform? int ico), j(10); cout << "i = " << i << endl; cout << "j = " << j << endl; while (i > j) { cout << "j-" « j << endl; j += 2; cout << "i = " << i << endl; } cout << "i = << i << endl; cout << "j = " << j << endl; 5 6 C 8 10 Infinite times Does the...
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;...
12. What is the output of the following C++ code? int x; int y; int *p = &x; int *q = &y; *p = 35; *q = 98; *p = *q; cout << x << " " << y << endl; cout << *p << " " << *q << endl; 13. What is the output of the following C++ code? int x; int y; int *p = &x; int *q = &y; x = 35; y = 46; p...
Hello, I am trying to get this Array to show the summary of NETPAY but have been failing. What is wrong? #include <iostream> #include <iomanip> using namespace std; main(){ char empid[ 100 ][ 12 ]; char fname[ 100 ][ 14 ], lastname[ 100 ][ 15 ]; int sum; int hw[ 100 ]; double gp[ 100 ], np[ 100 ], hr[ 100 ], taxrate[100], taxamt[ 100 ]; int counter = 0; int i; cout<<"ENTER EMP ID, FNAME, LNAME, HRS...