Question 2: Write a condition for each of the following: a) Testing a number n is even. b) Testing a char?
-
Question 2: Write a condition for each of the following: a) Testing a number n is even. b) Testing a char c) Testing a number n is odd and positive or n is even and negative. d) Testing a string st is the not the same of "Nothing". ,,, Computer Programming c++ !
-
Answer:
Hi.. Here are your answers: a) int N; if(N%2==0) cout<<""Even"; else cout<<"Odd"; b) if(sizeof(c)==1) cout<<"It is a char"; c) int N; if(N%2!=0&&N>0) cout<<"Odd and positive"; else if(N%2==0&&N<0) cout<<"Even and negative"; d) char str[10]="Nothing"; if(!strcmp(str,"Nothing") cout<<"It is same as nothing"; Please ask questions on C/ C++ at my blog: http://cplusplusatoz.blogspot.in/
Wafa at Yahoo! Answers Visit the source
Related Q & A:
- How to convert a char array into an int in C++?Best solution by Stack Overflow
- How can I convert a string number to a number in Perl?Best solution by Stack Overflow
- Is there a website where i can either download or play a program that will let me build a building, like?Best solution by Yahoo! Answers
- Are a c.n.a. and a medical assistant the same thing?Best solution by Yahoo! Answers
- Write a balanced net ionic equation for the following reaction?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.