Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string>
- using namespace std;
- int main()
- {
- string wyr = "drzewko"; ////string
- int dl = wyr.length(); //int
- string wyraz(dl, 'a'); //string
- int j = dl-1;
- string tab[dl]; //TABLICA STRINGÓW // czy można dodawać do tablicy stringa zwyklego ?
- cout<<"string nowy wypelniony 'a' po endlainach: "<<endl;
- for(int i= 0;i<dl;i++)
- {
- cout<<wyraz[i];
- cout<<endl;
- }
- -------------------------------------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------------------------
- for(int i= 0;i<dl;i++)
- {
- tab[i] += wyraz[i];
- tab[i] += wyr[i];
- }
- cout<<"wyraz z -a: "<<endl;
- cout<<tab<<endl<<endl;
- //////////////// ---------------------> tu jest problem dodaje do tablicy dwa stringi "aaaaaa" oraz "drzewko"
- //////////////// ---------------------> Chce by sie zapisywalo i wypisywalo pzeplatane słowo ad az ar ae aw ak ao
- //////////////// ---------------------> Oczywiscie reszta sie kompiluje jak i rowniez to tylko wychodza glupoty
- //////////////// ---------------------> zamiast tego wychodzi: 0x28fe6c ... to wskaźnik? Czy powiniene dodawać tablice do tablicy?
- for(int i= 0;i<dl;i++)
- {
- wyraz[i] = wyr[i];
- }
- cout<<"wyraz w tej samej kolejnosci w nowym stringu: "<<endl;
- cout<<wyraz<<endl;
- for(int i= 0;i<dl;i++)
- {
- wyraz[j] = wyr[i];
- j--;
- }
- cout<<"wyraz w tej samej kolejnosci w nowym stringu: "<<endl;
- cout<<wyraz<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment