can someone help me solve these please

1
2
3
4
5
6
7
8
9
10
Consider the code segment below:

   string myName;
   char yourName[32];
   char teacherName[32];


   strcat(yourName,"THAT'S ALL FOLKS!!");

   //-| Write the statement that has the same effect on string variable myName. 


1
2
3
4
Consider the code segment:
char Sentence[30];
cin.getline(Sentence,10); // Read up to 10 characters including
cout << Sentence;


1
2
3
4
5
Given equation below:

y = ( a+4x)/ 3x-4

write c++ assignment statement


// for this one i tried y = (a + 4*x) / (3*x - 4)
if variable yourName has no static storage duration then the code, that is the statement with strcat, is invalid because the variable is not initialized.


1
2
3
4
5
6
7
   string myName;
   char yourName[32];
   char teacherName[32];


   strcat(yourName,"THAT'S ALL FOLKS!!");
   //-| Write the statement that has the same effect on string variable myName.   


As for the string then you can write

myName += "THAT'S ALL FOLKS!!";

or

myName.append( "THAT'S ALL FOLKS!!" );
Last edited on
Topic archived. No new replies allowed.