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
  • Instruction: Do any 10 of the 14 questions. Each question is worth 10 points. (For each...

    Instruction: Do any 10 of the 14 questions. Each question is worth 10 points. (For each True/False question, if it is true, answer T and give reasons for your answer. If it is false, answer F and give a explicit counterexample or other explanation of why it is false.) 1) True or False: The set {x : x = : x = tany, y e [0,5)} is an compact subset of R, the set of all real numbers with the...

  • Question 8 (Chapters 1-8) [1 x 14 14 marks For the statements bellow, say if they are true or false. If true, give a short mathematical proof, if false, give a counterexample. (h) If f : Rn → R i...

    Question 8 (Chapters 1-8) [1 x 14 14 marks For the statements bellow, say if they are true or false. If true, give a short mathematical proof, if false, give a counterexample. (h) If f : Rn → R is convex and h : R → Rnxn s strictly convex and nondecreasing, then ho f is strictly convex (i) If f is strictly convex, then it is coercive. ) If f : Rn → R is such that the level...

  • 1 2 0 42 3 40 -80 64 48 -288 40 13 26 21-15 94-13) and...

    1 2 0 42 3 40 -80 64 48 -288 40 13 26 21-15 94-13) and 5 10 8-6 365 2 4 0 8 -6 -10 0 13 2-1 3·Let A = C 4 8 3 25 -2 9 5 1 42 3-1 9 10 22846-2 18 4 -4 3 21 3 2 334 15 26-2 14 5 48 -2 -10 -2 8 -8 814 16 28-23 148 36-6 56 (a) Find a basis for Nul (A)nNul (C) (b) Find...

  • Question 4: Eigenvalue Theory 2 Let A Cnxn. For each of the following statements show that it is ...

    Question 4: Eigenvalue Theory 2 Let A Cnxn. For each of the following statements show that it is true or give a counterexample to show that it is false (a) If λ is an eigenvalue of A, and μ є Cn then λ-μ is an eigenvalue of A-1 (b) If A is real and λ is an eigenvalue of A then so is-λ. (c) If A is real and λ is an eigenvalue of A, then so is λ. (d)...

  • 6. Determine whether each of the following is true or false (note: the statement is true...

    6. Determine whether each of the following is true or false (note: the statement is true if it is always true, otherwise it is false). If you say it is true then refer to a known result or give a proof, while if you say it is false then give a counterexample, i.e., a particular case where it fails. (a) If A, B and C are independent, the Pr(AlBnc)- Pr (A) (b) The events S., A are independent (S is...

  • how do u do 6? F-'(C-D)= F-'(C)-F-'(D). 4. (10 points) In following questions a function f...

    how do u do 6? F-'(C-D)= F-'(C)-F-'(D). 4. (10 points) In following questions a function f is defined on a set of real numbers. Determine whether or not f is one-to-one and justify your answers. (a) f(x) = **!, for all real numbers x #0 (6) f(x) = x, for all real numbers x (c) f(x) = 3x=!, for all real numbers x 70 (d) f(x) = **, for all real numbers x 1 (e) f(x) = for all real...

  • 4. For this question, we define the following matrices: 1-2 0 To 61 C= 0 -1...

    4. For this question, we define the following matrices: 1-2 0 To 61 C= 0 -1 2 , D= 3 1 . [3 24 L-2 -1] (a) For each of the following, state whether or not the expression can be evaluated. If it can be, evaluate it. If it cannot be, explain why. i. B? +D ii. AD iii. C + DB iv. CT-C (b) Find three distinct vectors X1, X2, X3 such that Bx; = 0 for i =...

  • For each variable of interest, do the following: 1. Find the mean, five-number summary, range, variance,...

    For each variable of interest, do the following: 1. Find the mean, five-number summary, range, variance, and standard deviation. Display these numbers in a format that is easy to understand. 2. For each variable of interest, use its five-number summary to construct a boxplot. Each boxplot must be constructed horizontally, and must be accompanied by a brief descriptive paragraph that assesses whether the data appear to be symmetrical, left-skewed, or right-skewed. Construct a 95% confidence interval for the mean μ...

  • In C++ Make a program that takes a positive integer 'n' and write an n x...

    In C++ Make a program that takes a positive integer 'n' and write an n x n matrix whose entries are listed as snail Example: (See picture) for n=6 Ej. Para n-6 2 2 2 20 21 22 23 24 7 19 32 33 34 258 18 31 36 35 26 9 17 30 29 28 27 10 16 15 14 13 12 11

  • 2. [2+9+6=17] Let X be a nonempty set. Two metrics d and d on X are...

    2. [2+9+6=17] Let X be a nonempty set. Two metrics d and d on X are said to be uniformly equivalent if the identity map from (X, d) to (X, d) a nd its in- verse are uniformly continuous. (a) Prove that uniform equivalence is indeed an equivalence relation on the class of metrics on X. (b) Let (X,d) and (x, ) be uniformly equivalent. Are the following true or false? (i) If (X, d) is bounded, then must also...

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