The purpose of using strcat function to append one to

This preview shows page 13 - 24 out of 27 pages.

output string1 not string2? The purpose of using strcat() function to append one to anather.We should use string 1 rather than string 2 because string 1 act as destination of reference while the second called source string when want to add to first string. 13
Image of page 13

Subscribe to view the full document.

14
Image of page 14
15
Image of page 15

Subscribe to view the full document.

9. Based on the following table, change the value of the function; Code Replace original code Output display line 1 strcat(string1,”belajar computer strcat(string,”belajar computer programming”); programming”)=Welcome 16
Image of page 16
2 strncat(string1, string3, 6); strncat(string1, string3, 6) 3 strcpy(string1,”Welcome”); strcpy(string1,”Welcome”) =Welcome 4 strncpy(string2,string1,7); strncpy(string2,string1,7) =Welcome 5 int a = strcmp(string3, “Khalil”); 17
Image of page 17

Subscribe to view the full document.

strcmp(string3, “Khalil”)=0 6 a = strncmp(string3, “Khalil”, 6); strncmp(string3, “Khalil”)=0 7 a = strlen(string2); strlen(string1)=8 Section 4: Pointers Open your preferred C++ IDE, and create new console project. 18
Image of page 18
Type the following program: // Student Name: xxxxxxxx Student ID: xxxxxxx // Lab Title: variables and adress Date: xx/xx/xxxx #include<iostream> using namespace std; int main(){ int myvar; cout<<"Enter an Integer : "; cin>>myvar; //enter integer in variable myvar cout<<"The enter data is "<<myvar<<endl; cout<<"And it is stored at "<<&myvar<<endl; //Adress value return 0; system("pause"); } 19
Image of page 19

Subscribe to view the full document.

20
Image of page 20
Compile, run your program and write your output in the table below. [Enter integer = 50] 3. Based on the output above, show the value of variable myvar. Variable address Storage value RAM name 0x24fe9c 50 myvar 4. Type the following program below, compile and run the program//Student Name: xxxxxxxxStudent ID: xxxxxxx//Lab Title: Array and addressDate: xx/xx/xxxx
Image of page 21

Subscribe to view the full document.

5. Type the following program below, compile and run the program
Image of page 22
Image of page 23

Subscribe to view the full document.

Image of page 24
  • Summer '16
  • Mashanum
  • Madrid Metro, Metropolitana di Napoli, Osaka Municipal Subway

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern