Madlib program help

this is a madlib program for some reason when it runs it works as expected except the first cin.get line for the first madlib isnt displaying the string idk what the problem is and i dont know where i would even start to fix it

wondering if it is a problem with the compiler (g++)

//
//
//
#include<iostream>
#include<cstring>
using namespace std;

void Intro()
{
cout << "Welcome to MadLib!\n";
}

void promptLibs()
{
cout<<"Please enter the following madlibs in order. (remember to press anter after your done with your input)\n";
cout<<"1. Time-span\n";
cout<<"2.Noun.\n";
cout<<"3.Verb.\n";
cout<<"4.Verb.\n";
cout<<"5.Noun (singular or plural).\n";
cout<<"6.Noun.\n";
cout<<"7.Verb (ending with -ing).\n";
cout<<"8.Two-Word Occupation.\n";
cout<<"9.Noun.\n";
cout<<"10.Noun.\n";
cout<<"11.Famous Person.\n";
cout<<"12.Adjective.\n";
cout<<"13.Verb.\n";
cout<<"14.Noun.\n";
cout<<"15.Noun (plural).\n";
cout<<"16.Noun (plural).\n";
cout<<"17.Verb Preposition.\n";
cout<<"18.Integer.\n";
cout<<"19.Verb.\n";
cout<<"20.Float Letter.\n";

}

char* getLibsOne()
{
char Lib[50];

cin.getline(Lib,50);
return Lib;

}

char* getLibsTwo()
{
char LibTwo[50];

cin.getline(LibTwo,50);

return LibTwo;
}

int getInt()
{
int clocktime;

cin >> clocktime;

do {

clocktime -= 12;

}while(clocktime>12);


return clocktime;
}

int main()
{
// char finish = "done"
char madLibOne[19][50];
int madLibInt;
char madLibTwo[3][50];

//while loop ?


Intro();
promptLibs();

for(int i = 1; i < 19; i++)
{
strcpy(madLibOne[i],getLibsOne());
}


madLibInt = getInt();

for(int v = 0; v < 2; v++)
{
strcpy(madLibTwo[v],getLibsTwo());
}


/*
for(int i=17; i<18; i++)
{
strcpy(madLib[i],getInt());
};


for(int i=18; i<21; i++)
{
strcpy(madLib[i],getLibs());
};
*/


cout << " A Day In The Life Of a College Student\n";
cout << "Every ";
cout << madLibOne[1];
cout << " I wake up and get off my ";
cout << madLibOne[2];
cout << ". I don‘t\n";
cout << "always have time to ";
cout << madLibOne[3];
cout << " a shower, but I always make sure to\n";
cout << madLibOne[4];
cout << " my hair. Once that‘s done I get some \n";
cout << madLibOne[5];
cout << ", and then it‘s off to my first ";
cout << madLibOne[6];
cout << ". I often get\n";
cout << "caught ";
cout << madLibOne[7];
cout << " in class. No one likes it when\n";
cout << "the ";
cout << madLibOne[8];
cout << " gives a surprise " ;
cout << madLibOne[9];
cout << ". My second class\n";
cout << "is ";
cout << madLibOne[10];
cout << " Theory. Dr. ";
cout << madLibOne[11];
cout << " is incredibly ";
cout << madLibOne[12];
cout << ",\n";
cout << "but I never ";
cout << madLibOne[13];
cout << " her because of her thick ";
cout << madLibOne[14];
cout << ". Her\n";
cout << " ";
cout << madLibOne[15];
cout << ", however, are really ";
cout << madLibOne[16];
cout << ". After lunch,\n";
cout << "I have no more ";
cout << madLibOne[17];
cout << " and I‘m free to ";
cout << madLibOne[18];
cout << "\n";
cout << "my friends. This is right around ";
cout << madLibInt;
cout << " O’clock. Before\n";
cout << "I go to bed I ";
cout << madLibTwo[0];
cout << " a little bit, in my room, ";
cout << madLibTwo[1];
cout << ".\n";

// finish = cin.getline() exit condition

}

Very likely that you have a mix of the operator>> and getline(). See the Notes at the following link:

http://en.cppreference.com/w/cpp/string/basic_string/getline

To find out how to resolve that.
Topic archived. No new replies allowed.