After String Concatenation first word is not displayed

Below is the code given i have made this program to concatenate two strings concatenation but after concatenation in display it doesnot displays the first word.....i think there is some thing missing in cin.ignore() kindly check and help me????

#include "stdafx.h"
#include <stdio.h>
#include <string>
#define MAX 100
using namespace std;
void main ()

char str[MAX],abc[MAX];
cout<<"\nEnter the string 1"; //Errors in this program are that after concatenation first letter is not displayed
cin.ignore(); //error is that i want to store result in another char say char d[MAX] but it gives error
cout<<"\nEnter The String 2";
cout<<"\nStrings after catenation are"<<str;


Last edited on
Indiscriminate use of cin.ignore().

The problem is that you ignore a character, then extract the first string, so if you enter "abc" for the first string, you only extract "bc".

Get rid of the first cin.ignore().

Last edited on
Topic archived. No new replies allowed.