0
Help me with this if you don't mind
#include <iostream> #include <vector> #include <numeric> using namespace std; class process{ public: void start(){ string a; string result; cin >> a; int b = 0; int siz = 0; int word = 0; string n; shift.push_back(a); for(int i = 0; i<shift[word].size(); i++){ letters.push_back(a.at(b)); copy.push_back(a.at(b)); b++; } do{ letters.insert(letters.end(), copy[siz]); for(int i = 1; i<letters.size(); i++){ n =+ letters[i]; } cout << n <<"\n"; siz++; } while(siz<b); } private: vector<string> shift; vector<char> letters; vector<char> copy; }; int main(){ process ok; ok.start(); }
5 Respuestas
+ 3
What is this code supposed to do? what is the expected final result? try first to change "n =+ letters[i];" into "n += letters[i];" : )
+ 1
lpang, thanks a lot, i missed that😁 (here is quest by the way: https://www.sololearn.com/learn/9885/?ref=app)
+ 1
yoohoo gonna post my final work;
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
class process{
public:
void start(){
string a;
string result;
string n;
int c = 1;
int b = 0;
int siz = 0;
int word = 0;
cin >> a;
shift.push_back(a);
for(int i = 0; i<shift[word].size(); i++){
letters.push_back(a.at(b));
copy.push_back(a.at(b));
b++;
}
do{
letters.insert(letters.end(), copy[siz]);
for(int i = c; i<letters.size(); i++){
n += letters[i];
}
c++;
cout << n <<", ";
siz++;
n.clear();
}
while(siz<copy.size());
}
private:
vector<string> shift;
vector<char> letters;
vector<char> copy;
};
int main(){
process ok;
ok.start();
}
0
it's so complicated, any efforts appreciated🤗
0
Good job! congratulations and good luck! : )