Concatenating char arrays in C++ (tricky) -


so i've got exercise in have concatenate 2 char arrays follows:

const int maxi=100; char group[maxi+7]="things/" char input[maxi];  cin >> input; //doing here! cout << group << endl; 

have make smthing happen returns -- things/input_text --

the tricky part not allowed use pointers, string library or kind of dynamic arrays.

what do?

edit: dont need print it, need variable has value: things/input_text, i'm going use else!

edit2: can't use < string > library, means, can't use strcat() or on library. i'm provided module triggered follows:

void thing(group, stuff, more_stuff); 

that's it.

something this?

#include <iostream>  using namespace std; const int maxi=100;  int main() {     char group[maxi+7]="things/";     char input[maxi];     cin >> input;     for(int i=0; i<maxi; i++)     {         group[7+i]=input[i];         if(input[i]=='\0') break;//if string shorter maxi     }     cout << group << endl; } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -