#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string a ="hello";
string b = "dear";
for (int i = 0; i < 3; ++i)
{
string x = a.append(b);
cout<<x<<" "<<b<<" "<<a<<endl;
}
}
why value of a changing i am just changing x
output::
hellodear dear hellodear
hellodeardear dear hellodeardear
hellodeardeardear dear hellodeardeardear
Aucun commentaire:
Enregistrer un commentaire