//*********************************************** // R. A. Hillyard // cstringFunctions.cpp // // program to show use of cstring functions // included in the cstring and cstdlib library //********************************************** #include<iostream> #include<cstring> #include<cstdlib> using namespace std; int main() { char s[20] = "Hello There "; char t[20] = "From me to you"; char buf[40]; cout << "the string: " << s << " has " << strlen(s) << " Characters\n"; cout << "the string: " << t << " has " << strlen(t) << " Characters\n"; strcpy(buf, s); cout << "buf: " << buf << "\nhas " << strlen(buf) << " Characters\n"; strcat(buf, t); cout << "buf: " << buf << "\nhas " << strlen(buf) << " Characters\n"; cout << "enter a floating point number: "; cin >> s; double t1 = atof(s); cout << "enter a integer number: "; cin >> t; int t2 = atoi(t); cout << t1 << " * " << t2 << " = " << t1*t2 << endl; return 0; }//end main /*******************program output*************************/ the string: Hello There has 12 Characters the string: From me to you has 14 Characters buf: Hello There has 12 Characters buf: Hello There From me to you has 26 Characters enter a floating point number: 15.55 enter a integer number: 4 15.55 * 4 = 62.2