> C++ Homework help.?

C++ Homework help.?

Posted at: 2014-12-18 
You declare a variable by writing

(variable type) name;

int x;

Initialize it by assigning it a value:

int x= 25;

Declare the variable and initialize it at the same time:

(variable type) name = xx;

example:

int x = 25;

The rest is going to be essentially extensions of the same.

To add a value to a variable, set the variable equal to itself with the added value added.

x = x + 5;

If that doesn't give you every thing you need to know, then drop the class now while you can get some money back.

So what one are you having problems with?

These are very SIMPLE tasks. Like as basic as you can get. If you cant understand this, I hear McDonalds is hiring.

char x='A';

This is question 12 from C++ Programming: From Problem analysis to program design. 6th edition by D.S. Malik

Write C++ statement(s) that accomplish the following:

a) Declare int variables x and y. Initialize x to 25 and y to 18.

b) Declare and initialize an int variable temp to 10 and a char variable to 'A'.

c) Update the value of an int variable x by adding 5 to it.

d) Declare and initialize a double variable payRate to 12.50.

e) Copy the value of an int variable firstNum into an int variable tempNum.

f) Swap the contents of the int variables x and y. (declare additional variables if needed)

g) Suppose x and y are double variables. Output the contents of x, y, and the expression x + 12 / y - 18.

h) Declare a char variable grade and set the value of grade to 'A'.

I) Declare int variables to store four integers.

j) Copy the value of a double variable z to the nearest integer into an int variable x.