char line[80] = "this is a test; IT IS ONLY A TEST"; char first[21]; char sec[21]; char third[31]; cout << "line is: " << line << endl; strncpy(first,line,4); first[4] = '\0'; cout << "length of first: " << strlen(first) << endl; cout << "first is: " << first << endl; strcat(line,first); cout << "line is: " << line << endl; strncpy(sec,line,14); sec[14] = '\0'; strcpy(third,sec); for (int i = 0 ; i < strlen(third) ; i++) third[i] = toupper(third[i]); cout << "third is: " << third << endl; cout << "sec is: " << sec << endl;
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2002