### Assignment Question!!!!!!

Q1. Write the c++ implementation for the following pseudocode

*Get number
*check=number%2
*if check =0 display "its even number "
*else display "its an even number "

Q2. write the c++ conditional statements for the following situations

a.if the data is between 25 to 50 or the data is more than 100
b.if the data character is not A or a
c. if data is equal or less than zero but more than -250

stuckeed in these questions!!!!!!!!!!!!!!!

How far did you get, what's the sticking point?

By the way, the first part doesn't make sense:
 *if check =0 display "its even number " *else display "its an even number "

Are there to be no odd numbers?

If you are really stuck, then this might be a good starting point:
http://www.cplusplus.com/doc/tutorial/
Last edited on
Q1. Write the c++ implementation for the following pseudocode

*Get number
*check=number%2
*if check =0 display "its even number "
*else display "its an odd number "

typing error !!! can you solve it now !!!!
It's obviously a homework problem. Try writing the code out and if you have problems/questions, post them and we'll see if we can push you in the right direction, but do not expect anyone here to write this for you. It's not very complicated, just give it a shot.
closed account (3qX21hU5)
Here is some framework for you to start working on.

 ``1234567891011121314151617181920`` ``````#include using namespace std; int main() { int number; cin >> number; if ( This is where number%2 is done) { // This is where you output text if the number is even } else { // This is where you output text if the number is odd } return 0; }``````

That should give you all you need and basically solves your question. All you need to do is fill in the blanks.
thnx bro wht about for the second question?
closed account (3qX21hU5)
That ones should be easy enough for you to figure out if you can do the first one.

It is three different conditional statements.

1) `if (data is between 25 - 50 OR over 250)`

2) `if (variable is not 'a' OR 'A')`

3) I'll let you do this one :)
i tried alot but i still couldn't make it
*Get number
*check=number%2
*if check =0 display "its even number "
*else display "its an even number "

 ``1234567891011121314151617181920`` `````` #include using namespace std; int main() { int num; cout<<"Enter a number: "; cin>>num; if(num%2==0) { cout<<"It's an even number"; } else { cout<<"Its an odd number "; } cout<

This is such a basic program. I am not sure why you are having trouble writing it after the hint was given above by some other members. Spend some time on C++ otherwise you will be stuck when you study new concepts like Pointers, Functions, Arrays etc..I think you should be able to solve 2nd problem now.
 i tried alot but i still couldn't make it

http://hyperboleandahalf.blogspot.com/2010/04/alot-is-better-than-you-at-everything.html

If you tried, perhaps you could show some evidence of that. Most people around here would much rather tell you what you're doing wrong than outright supply you the answer.
#include <iostream>

using namespace std;

void main()
{
int number;
cout<<"Enter the number\n";
cin >> number;

if (number%2==0)
{cout<<"its an even number\n";}
else
{cout<<"its an odd number\n";}
system("pause");
}

this is evidence for question 1 . but im stucked in question no 2
question 1 is easy !!!!
i dont know how to do question 2?
closed account (3qX21hU5)
Well your answer for question one is wrong to. main need to be `int main()` not `void main()`. Main always returns a integer so that is why it need to be int. If you compiler compiles with `void main()` I would highly suggest switching to a new compiler or updateding (I'm assuming your probably using Bloodshed Dev C++, if thats the case upgrade to the new Orwell Dev C++ which has just been updated)

Also I gave you the outline for question 2 so you should be able to do it if you did a little research and not just look for people to give you the answers.
Topic archived. No new replies allowed.