P
PerritoPerron
//I need a little help with this program, it runs but the output is not
correct.
//Can i get some help here please u fellas???
// This Program asks for user input like 1 && 0 and prints if it is true or
false
// it calculates the input to perform Logical operation from input
#include <iostream>
using namespace std;
// Defines class
class Myclass{
public:
int func();
};
// Function to perform operation
int Myclass::func(){
char x[32] = ""; // array to receive input
cout << "\n\t\t\t T R U T H T A B L E\n" // asks for input
<< "\t\t\t ========= =========\n\n"
<< "Logical operators allow us to form more complex test expressions\n"
<< "for decision and repetition statements. The logical operators
are:\n\n"
<< "1. && (logical and)\n"
<< "2. || (logical or)\n"
<< "3. ! (logical not)\n\n"
<< "Please enter 1 for true, 0 for false with a logical operator\n"
<< "Parentheses may be used to alter the order in which operators are
applied.\n"
<< "Example:\n"
<< "1 && 0 or 1 || 0 ";
cin.getline(x, 32, '\n'); // stores input in variable called x
cout << bool (x) << endl; // prints out true or false value
return 0;
}
// Main function invokes perform operation function
int main(){
Myclass mc;
mc.func();
return 0;
}
correct.
//Can i get some help here please u fellas???
// This Program asks for user input like 1 && 0 and prints if it is true or
false
// it calculates the input to perform Logical operation from input
#include <iostream>
using namespace std;
// Defines class
class Myclass{
public:
int func();
};
// Function to perform operation
int Myclass::func(){
char x[32] = ""; // array to receive input
cout << "\n\t\t\t T R U T H T A B L E\n" // asks for input
<< "\t\t\t ========= =========\n\n"
<< "Logical operators allow us to form more complex test expressions\n"
<< "for decision and repetition statements. The logical operators
are:\n\n"
<< "1. && (logical and)\n"
<< "2. || (logical or)\n"
<< "3. ! (logical not)\n\n"
<< "Please enter 1 for true, 0 for false with a logical operator\n"
<< "Parentheses may be used to alter the order in which operators are
applied.\n"
<< "Example:\n"
<< "1 && 0 or 1 || 0 ";
cin.getline(x, 32, '\n'); // stores input in variable called x
cout << bool (x) << endl; // prints out true or false value
return 0;
}
// Main function invokes perform operation function
int main(){
Myclass mc;
mc.func();
return 0;
}