True/false table

Whats wrong with this?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<iostream>
using namespace std;
#include <iomanip>
int main()
{
	cout << "And"" << 't' << "Or" << 't' << "Not" << endl;
	cout << "A" << 't'<< "B" << 't' << "A && B"<< 't' << "A"<< 't' 
	<< "B"<< 't' << "A || B << "A" << 't' << "!A"<< endl;
	cout << setw(5) << "false(0)" << setw(5)<< "false(0)"
	<<setw(5) <<"false(0)" <<  setw(5) <<"false(0)" << setw(5) << "false(0)"
	<< setw(5) <<"false(0)" << setw(5)<< "false(0)" << setw(5) << "true(1)" <<endl;


	return 0;

}
Last edited on
"And""

"And"

't' you mean tab which is '\t'
Try this. Its based on what he said to correct ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<iostream>
using namespace std;
#include <iomanip>
int main()
{
	cout << "And" << '\t' << "Or" << '\t' << "Not" << endl;
	cout << "A" << '\t'<< "B" << 't' << "A && B"<< '\t' << "A"<< '\t' 
	<< "B"<< '\t' << "A || B" << "A" << '\t' << "!A"<< endl;
	cout << setw(5) << "false(0)" << setw(5)<< "false(0)"
	<<setw(5) <<"false(0)" <<  setw(5) <<"false(0)" << setw(5) << "false(0)"
	<< setw(5) <<"false(0)" << setw(5)<< "false(0)" << setw(5) << "true(1)" <<endl;


	return 0;

}
Last edited on
Topic archived. No new replies allowed.