Could you please help with answers to the below questions. I am still learning c++ and would appreciate your help
1. what is the difference between
int value =2; int value =2;
cout << ++ value <<endl; AND cout << value++ << endl;?
2. What are magic numbers? Whay are they considered bad practise. How does c++ language encourage the programmer to avoid using magic numbers?
3 Intergers are represented as sequence of bits. what is the correct order ( from largest to smallest) of relative sizes in bits of the interger typers
a long >= char >=short >=int
b long>= int >=short>=char
c long >=int >=char>=short
d long >=char >=int >=short
4. how can one write a c++ programme which does the following
a create a vector of size 1000 and have it store the values 0.1, 1.1, 2.1, 3.1,....999.1
b trucate the vector to a size of 5
c print out how many values the vector is storing
d empty out the vector so that it stores no values
5. rewrite the following code correcting all problems found
void calculatevalues (const int &a, float *b, int &c)
{
d = 20.4;
if (*a =0)
*a += 1
c = a +d;
else
b= c/d ;
c= a- b +d;
}
Hint if a =4, b =0.0 and c=5 when this function is called, their values when this fucntion returns should be a=4, b=0.25 and c= 24.15
6 a The string class in the standard c++ library is a template for any type character of character representation.
write a function called copy which takes two parameters of the string type. The first parameter is the source string ( or the string to be copied) and the second parameter is the target string ( or the string that recieves the copy). This function need not return anything.
One is not allowed to use the fuction strcpy (.....)!
b) show how one would use (or call) your function by writting some c++ code to copy one string inro another.
7 What are the guidelines or rules for c++ programmers using inline functions?