I tried to make a code that takes the first two letters in three separate arrays, and concatenate them. For example, I put Dog, Cat, Rabbit, and it must show "DoCaRa". I tried to use cin.get but it only reads the first one, then it doesn´t let me enter new arrays. Here's the code:
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char or1[99],or2[99],or3[99];
cout << "Enter array: ";
cin.get (or1, 3);
cout << "Enter array: ";
cin.get (or2, 3);
cout << "Enter array: ";
cin.get (or3, 3);
cout << "\n--" << or1 << or2 << or3 << "--\n";
}
Output: Enter array: dog Enter array: Enter array: --dog--