#include #include #include using namespace std; void main(){ string s = "tweedle", v("dee"); string name; cout << "enter your first and last name" << endl; cin >> name; cout << name << endl;; cout << s << " " << v << endl; if(s=="tweedle") cout << "tweedle encountered" << endl; cout << s[2] << endl; s[2] = 'i'; s = v; if(s != v) cout << " tweedle trouble " << endl; cout << s << endl; char cs[] = "wombat"; char cv[5] = {'x','r','a','y','\0'}; cout << cs << " " << cv << endl; // will work but cause memory corruption //strcpy(cv,cs); //cs = cv; illegal strcpy(cs,cv); cout << cs << endl; // invalid compares pointers if(cs == "xray"){ cout << "copy ok" << endl; } if(!strcmp(cs,"xray")){ cout << "strcmp says copy ok" << endl; } }