215
a)
satr2. append (satr1); ko‗rinishidan foydalanilganda satr2 ning oxiridan
satr1 ulanadi. Agar satr2 initsializatsiya qilinmagan bo‗lsa, satr2 o‗zgaruvchi satr1
o‗zgaruvchining qiymatini oladi;
b)
satr2. append (satr1,n,m); ko‗rinishidan foydalanilganda satr1ning n –
belgisidan keyingi m ta belgisi satr2 ning oxiridan ulanadi;
c)
satr2. append (satr1,n); ko‗rinishidan foydalanilganda satr1
char turli
massiv bo‗lishi kerak. Funksiya char turli satr1ni string turga aylantirib,
uning
dastlabki n ta belgisini satr2 oxiridan ulaydi.
Funksiyaning vazifasini o‗zlashtirish uchun quyidagi dastur va uning
natijasini tahlil qiling.
#include
#include
using namespace std;
int main()
{ int j,i,s,n,m;
string
s1="matnni
ulash",s3,s4="bo‗lakni",s5,s7="bizning
",s2="matnga ";
char s6[]="assalom"; s2.append(s1);cout<<"s2="<s3.append(s1);cout<<"s3="<s4.append(s1,6,6);cout<<"s4="<s5.append(s6,4);cout<<"s5="<s7.append("maktabdosh",6);cout<<"s7="<system("pause");
return 0;
}
Dastur natijasi quyidagicha bo‗ladi
s2=matnga matnni ulash
s3=matnni ulash
s4=bo‗lakni ulash
s5=assa
s7=bizning maktab