Cpp Programming
Guest
string t1; if(t1.empty()==true) cout << "Zmienna tekstowa jest pusta"; else cout << "Dlugosc zmiennej tekstowej to " << t1.length(); cout << endl; string t2="Pawel"; cout << "Tekst to: " << t2 << endl; cout << "Dlugosc zmiennej tekstowej to: " << t2.length() << endl; cout << "Przed ostatni znak to " << t2.at(t2.length()-2) << endl; t2.append("PawelS"); cout << "Doklejone: " << t2 << endl; t2.clear(); cout << "Wyczyszczone. Wypisywanie: " << t2 << endl; cout << endl; string nowa; cout << "Podaj tekst: "<< endl; cin >> nowa; cout << "Wczytano do zmiennej"<< endl; cout << nowa; cout << endl; string sz; cout << "Podaj ciag znakow ktorego mam wyszukiwac: "<< endl; cin >> sz; cout << "Szukany tekst rozpoczyna sie od znaku numer: " << nowa.find(sz)+1 << endl; if (nowa.find(sz)+1==0) cout << "Nie ma takiego ciagu znakow" << endl; cout << endl; string nowa1="Jan Kowalski"; string nowsza=nowa1.substr(4,8); cout << "Wycinanie tekstu. Wyciety tekst to: " << nowsza << endl; cout << endl;