Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 12-2
- #include "String2.h"
- #include <cstring>
- #include <cctype>
- using namespace std;
- int main()
- {
- String s1(" i ucze sie C++.");
- String s2 = "Podaj swoje imie: ";
- String s3;
- cout << s2;
- cin >> s3;
- s2 = "Mam na imie: " + s3;
- cout << s2 << ".\n";
- s2 = s2 + s1;
- s2.stringUp();
- cout << "Ciag\n" << s2 << "\nzawiera " << s2.howMany('A') << " 'A'.\n";
- s1 = "czerwona";
- String rgb[3] = { String(s1), String("zielona"), String("niebieska") };
- String ans;
- cout << "Podaj nazwe barwy podstawowej: ";
- bool success = false;
- while (cin >> ans)
- {
- ans.stringLow();
- for (int i = 0; i < 3; i++)
- {
- if (ans == rgb[i])
- {
- cout << "Prawidlowo!\n";
- success = true;
- break;
- }
- if (success)
- break;
- else
- cout << "Sprobuj ponownie!\n";
- }
- }
- cout << "Zegnam\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment