I am doing private studies on c++ and have no tutors. Can someone help me with the following. I will write exams end of the year in c++
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 (.....)!