• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

please help with with basic c++ hw

Topplayer

Senior member
hey guys,
I really need help bad. i cant figure out how to do this. i was wondering if someone could help,i really appreciate it. ok so the problem goes as stated

given three bool variables p,q and r provide complete truth tables for the following expressions
2.1)
p && q

2.2)
!(p||q||r)

2.3)
!(p && r)



im not looking to cheat because i normally do all my work but i cant figure out how to do this with out the values of the variables, can some one please help me
 
Technically not even really C++, except for the boolean variable part. They're just looking for truth tables. I'd take a stab, but I was horrible with truth tables. They just never made sense to me. So I would end up hindering you more than helping. Check out wikipedia for some help here.
 
Originally posted by: Topplayer
but it doesnt say that i can pick values. it says given three bool variables. you think i can just pick values?

Don't be dense. This isn't rocket surgery. You're not really picking values, you're writing all of the possible combinations of T/F or 1/0
 
so if im alittle stubborn ive been awake since yesterday. im gonna use 1 for p and 0 for q what should i use for r?
 
Originally posted by: tfinch2
Originally posted by: Topplayer
but it doesnt say that i can pick values. it says given three bool variables. you think i can just pick values?

Don't be dense. This isn't rocket surgery. You're not really picking values, you're writing all of the possible combinations of T/F or 1/0

another hint: with n variables, there are 2^n possible combinations.

2 variables: 2^2 = 4 possible combinations
3 variables: 2^3 = 8 poss comb
etc
 
p q r !(p||q||r)
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

There are 3 variables, so there are 2^3 possible combinations of T/F, then you fill in the truth table for the last column. If this doesn't make sense, it's time to go to office hours.
 
Originally posted by: tfinch2
p q r !(p||q||r)
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

There are 3 variables, so there are 2^3 possible combinations of T/F, then you fill in the truth table for the last column. If this doesn't make sense, it's time to go to office hours.

Don't forget, a lot of people prefer that you show your steps in between (or what's considered a full truth table). Using the above example:

p q r p||q (p||q)||r !((p||q)||r))
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

I added the extra parenthesis for simply showing the flow, although the order of operations should be understood.
 
Back
Top