Question

Implement C++ program for each of the following. Let D = [-48, -14, -8, 0, 1,...

Implement C++ program for each of the following.
Let D = [-48, -14, -8, 0, 1, 3, 16, 23, 26, 32, 36] Each answer is either True or False. If False, give example
of number(s) that make it False. i.e. The Counterexample. ∀x∈D, if x is odd then x > 0


Let D = [-48, -14, -8, 0, 1, 3, 16, 23, 26, 32, 36] Each answer is either True or False. If False, give example
of number(s) that make it False. i.e. The Counterexample. ∀x∈D, if x is less than 0 then x is even.


Let D = [-48, -14, -8, 0, 1, 3, 16, 23, 26, 32, 36] Each answer is either True or False. If False, give example
of number(s) that make it False. i.e. The Counterexample. ∀x∈D, if x is even then x <= 0;


Let D = [-48, -14, -8, 0, 1, 3, 16, 23, 26, 32, 36] Each answer is either True or False. If False, give example
of number(s) that make it False. i.e. The Counterexample. ∀x∈D, if the ones digit of x is 2, then the tens digit is 3 or 4.


Let D = [-48, -14, -8, 0, 1, 3, 16, 23, 26, 32, 36] Each answer is either True or False. If False, give example
of number(s) that make it False. i.e. The Counterexample. ∀x∈D,if the ones digit of x is 6, then the tens digit is 1 or 2.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

C++ Program:

#include<iostream>
using namespace std;

void function1(int D[]){
int flag=0;
for(int i=0;i<11;i++){
if(D[i]%2!=0)
{
if(D[i]<=0){
if(flag==0){
cout<<"The number(s) that make Statement 1 false: ";
flag=1;
}
cout<<D[i]<<" ";
}
}
}
if(flag==0)
cout<<"Statement 1 is True";
cout<<"\n\n";
}

void function2(int D[]){
int flag=0;
for(int i=0;i<11;i++){
if(D[i]<0)
{
if(D[i]%2!=0){
if(flag==0){
cout<<"The number(s) that make Statement 2 false: ";
flag=1;
}
cout<<D[i]<<" ";
}
}
}
if(flag==0)
cout<<"Statement 2 is True";
cout<<"\n\n";
}

void function3(int D[]){
int flag=0;
for(int i=0;i<11;i++){
if(D[i]%2==0)
{
if(D[i]>0){
if(flag==0){
cout<<"The number(s) that make Statement 3 false: ";
flag=1;
}
cout<<D[i]<<" ";
}
}
}
if(flag==0)
cout<<"Statement 3 is True";
cout<<"\n\n";
}

void function4(int D[]){
int flag=0;
for(int i=0;i<11;i++){
if(D[i]%10==2)
{
int temp=D[i]/10;
temp=temp%10;
if(temp!=3&&temp!=4){
if(flag==0){
cout<<"The number(s) that make Statement 4 false: ";
flag=1;
}
cout<<D[i]<<" ";
}
}
}
if(flag==0)
cout<<"Statement 4 is True";
cout<<"\n\n";
}

void function5(int D[]){
int flag=0;
for(int i=0;i<11;i++){
if(D[i]%10==6)
{
int temp=D[i]/10;
temp=temp%10;
if(temp!=1&&temp!=2){
if(flag==0){
cout<<"The number(s) that make Statement 5 false: ";
flag=1;
}
cout<<D[i]<<" ";
}
}
}
if(flag==0)
cout<<"Statement 5 is True";
cout<<"\n\n";
}

int main(){
int D[11]={-48,-14,-8,0,1,3,16,23,26,32,36};
function1(D);
function2(D);
function3(D);
function4(D);
function5(D);
return 0;
}

Output:

Add a comment
Know the answer?
Add Answer to:
Implement C++ program for each of the following. Let D = [-48, -14, -8, 0, 1,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT