I am becomming confused

I have two programs that I am having trouble makeing here are the steps
1. write a program that declares two constants (A and B)
(This is where I get lost)
2. In itialize A=1 and B=2.2
3. Declare an int named c and float named d
4. Initialize C=A and D=B
5. write statments to print c and d onto the screen

and this is the second one
1. write a program that declares a string object named mystring. leavin the object empty
2. use the assignment operator to assign the characer 'A'
3. print the contents of the string onto the screen
(this is where I get lost
4. concatenate the charcter 'B' to the end of the string
5. Print the contents of the string to the screen
6. Print the length of the string to the screen using the following statement: cout << mystring.length()<<'\n';
7. concatenate the string "CDEFG" to the end of the string
8. print contents of the string to the screen

I would appreciate help
THANKS
Initialize means to assign a variable the value. i.e. Initialize A = 1 would mean to create a variable called A and assign 1 to it.

Concatenate means to attach to the end. So if they said 'Concatenate "ab" onto "cd"', then you should end up with "cdab".
Program #1
1
2
3
4
5
6
7
int A=1;//declare and initialize variable A with constant int 1
float B=2.2//declare and initialize variable B with the value 2.2.B cannot be an int only a float or //double.
int c;//declare c
float d;//declare d
int C=A;// declare and initialize C with A
float D=B;//declare and initialize D with B
cout<<"c"<<c<<"d"<<d<<endl;//this will print garbage as 'c' and 'd' have not been initialized. 

Now post your code for both programs so that we can see how you are doing.
1
2
int A=1;//declare and initialize variable A with constant int 1
float B=2.2//declare and initialize variable B with the value 2.2.B cannot be an int only a float or //double. 


I think it says declare constants, so it should be like this instead.

1
2
const int A = 1;
const float B = 2.2;
Topic archived. No new replies allowed.