
#include <iostream>
using namespace std;
int main()
{ //Declare and intialize objects
bool A(false), B(false), C(false);
//Print table header condition is (A && B || B &&
C)
cout << "TABLE 3.2\n A\tB\tC\t\tA && B || B
&& C" << endl;
cout << "_________________________________________________"
<< endl;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B || B && C)
<< endl;
//Toggle C
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B || B && C)
<< endl;
//Toggle B and C
B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B || B && C)
<< endl;
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B || B && C)
<< endl;
//Toggle A, B and C
A = !A; B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B || B && C)
<< endl;
//Repeat the pattern for B and C..
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B || B && C)
<< endl;
//Toggle B and C
B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B || B && C)
<< endl;
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B || B && C)
<< endl;
system("pause");
return 0;
}
#include <iostream>
using namespace std;
int main()
{ //Declare and initialize objects
bool A(false), B(false), C(false);
//Print table header condition is (A && B || B &&
C)
cout << "TABLE 3.2\n A\tB\tC\t\tA && B && C"
<< endl;
cout << "_________________________________________________"
<< endl;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B && C) <<
endl;
//Toggle C
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B && C) <<
endl;
//Toggle B and C
B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B && C) <<
endl;
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B && C) <<
endl;
//Toggle A, B and C
A = !A; B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B && C) <<
endl;
//Repeat the pattern for B and C..
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B && C) <<
endl;
//Toggle B and C
B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B && C) <<
endl;
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A && B && C) <<
endl;
system("pause");
return 0;
}
Output:

#include <iostream>
using namespace std;
int main()
{ //Declare and initialize objects
bool A(false), B(false), C(false);
//Print table header condition is (A || B || B || C)
cout << "TABLE 3.2\n A\tB\tC\t\tA || B || C" <<
endl;
cout << "_________________________________________________"
<< endl;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A || B || C) << endl;
//Toggle C
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A || B || C) << endl;
//Toggle B and C
B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A || B || C) << endl;
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A || B || C) << endl;
//Toggle A, B and C
A = !A; B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A || B || C) << endl;
//Repeat the pattern for B and C..
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A || B || C) << endl;
//Toggle B and C
B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A || B || C) << endl;
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t\t" << (A || B || C) << endl;
system("pause");
return 0;
}

#include <iostream>
using namespace std;
int main()
{ //Declare and initialize objects
bool A(false), B(false), C(false);
//Print table header condition is (A || B || B || C)
cout << "TABLE 3.2\n A\tB\tC\t
A&&B||B&&C\t\tA&&B&&C\t\tA||B||C"
<< endl;
cout <<
"__________________________________________________________________________"
<< endl;
cout << A << '\t' << B << '\t' << C
<< "\t\t" << (A&&B||B&&C )<<
"\t\t " << (A&&B&&C)<< "\t\t "
<<(A||B||C) << endl;
//Toggle C
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t" << (A&&B||B&&C )<<
"\t\t " << (A&&B&&C)<< "\t\t "
<<(A || B || C) << endl;
//Toggle B and C
B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t" << (A&&B||B&&C )<<
"\t\t " << (A&&B&&C)<< "\t\t "
<<(A || B || C) << endl;
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t" << (A&&B||B&&C )<<
"\t\t " << (A&&B&&C)<< "\t\t "
<<(A || B || C) << endl;
//Toggle A, B and C
A = !A; B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t" << (A&&B||B&&C )<<
"\t\t " << (A&&B&&C)<< "\t\t "
<<(A || B || C) << endl;
//Repeat the pattern for B and C..
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t" << (A&&B||B&&C )<<
"\t\t " << (A&&B&&C)<< "\t\t "
<<(A || B || C) << endl;
//Toggle B and C
B = !B; C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t" << (A&&B||B&&C )<<
"\t\t " << (A&&B&&C)<< "\t\t "
<<(A || B || C) << endl;
//Toggle C again
C = !C;
cout << A << '\t' << B << '\t' << C
<< "\t\t" << (A&&B||B&&C )<<
"\t\t " << (A&&B&&C)<< "\t\t "
<<(A || B || C) << endl;
system("pause");
return 0;
}

#include <iostream> using namespace std; int main() { //Declare and intialize objects bool A(false), B(false), C(false);...
C++ question #include <iostream> using namespace std; void printReverse(int); int main() { int number = 12345; cout << "Original : " << number << endl; cout << "Reversed : "; printReverse(number); } void printReverse(int x) { if (x == 0) return; cout << x % 10; printReverse(x /= 10); } Modify the above recursive program to output the number in the same order. Note that the program still should break up the number and then output it in the...
Watermelon Problem: The answer should not include any whitespace. #include<iostream> using namespace std; int main() { double distance, gravity =9.8, height; int time, t=0; cout<<"Please input the time of fall in seconds:"<<endl; [ A ] // Get the user input of the time of fall in seconds (Use cin>> method) cout<<endl; cout<<"Please input the height of the bridge in meters:"<<endl; [ B ] // Get the user input of the height of the bridge in meters (Use cin>>...
#include <iostream> #include <conio.h> #include<limits> using namespace std; int main(){ char oparand, ch = 'Y'; int num1, num2, result; while(ch == 'Y'){ cout << "Enter first number: "; cin >> num1; while(1){//for handling invalid inputs if(cin.fail()){ cin.clear();//reseting the buffer cin.ignore(numeric_limits<streamsize>::max(),'\n');//empty the buffer cout<<"You have entered wrong input"<<endl; cout << "Enter first number: "; cin >> num1; } if(!cin.fail()) break; } cout << "Enter second number: "; cin >> num2; while(1){ if(cin.fail()){ cin.clear(); cin.ignore(numeric_limits<streamsize>::max(),'\n'); cout<<"You have entered wrong input"<<endl; cout <<...
What prints here? # include <iostream> using namespace std; int main() -{int a = 7; bool b = a -2; cout <<" b is" << endl;} b is false Syntax error Wrong type for b. 1s 0 is true is 5 is 1
Consider the following C++ program: #include <iostream> #include <cstdlib> using namespace std; int main int n =0; int i = 0; cout << "Please enter a strictly positive number:"; cin >> n if (n <= 0) exit(EXIT_FAILURE) while (n > 1) n-n/2; i << endl; cout"Output:" return 0; Answer the following questions: What is the output of the program for each of the following values of n: -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9? What does...
Program 2 #include <iostream> #include <cmath> using namespace std; int main() { const double PI = 3.141592653; int degrees; double radians; cout << "Enter a value for the degree of an angle\n"; cin >> degrees; // translate the formula for converting degrees to radians into C++: // // degrees x PI // ------------ = radians // 180 radians = _____________________________________; // Refer to p. 127 for help below....
This is for C++ #include <random> #include <iostream> #include <ctime> using namespace std; /* In the game of craps, a shooter rolls 2 dice and adds the dots on the upper most faces of the dice. 7 or 11 on the first roll wins, 2, 3, or 12 on the first roll loses, andthing else is call the point and the player rolls again The following program fragment uses 1-way if statements simulate the 1st roll of the dice. Replace...
Use this code to create multiple functions.
#include<iostream>
#include<iomanip>
#include<fstream>
using namespace std;
int main()
{
cout << fixed << showpoint <<
setprecision(2);
ofstream outFile;
outFile.open("Feras's.txt");
outFile << "..Skinny Feras's Restaurant ..\n\n" <<
endl;
int choise=10, quantity;
float paid, SubTotal=0, Tax = .10, Total, RM, more;
while(choise!=0)
{
system("cls");
cout << "\t**Welcome To Skinny Alsaif Restaurant Lol**"
<< endl;
cout << "\nWhat would you like to have?" <<
endl;
cout << "1. Burger." << endl;
cout << "2. Pizza." <<...
#include <iostream> #include <fstream> using namespace std; //constants const int CAP = 100; //function prototypes bool openFile(ifstream &); void readData(ifstream &, int [], int &); void printData(const int [], int); void sum(const int[], int); void removeItem(int[], int &, int); int main() { ifstream inFile; int list[CAP], size = 0; if (!openFile(inFile)) { cout << "Program terminating!! File not found!" << endl; return -1; } //read the data from the file readData(inFile, list, size); inFile.close(); cout << "Data in file:" <<...