I'd like to do the following, but without including string:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s1,s2;
char c;
cout<<"input a string: "<<endl;
cin>>s1;
cout<<"input a character: "<<endl;
cin>>c;
cout<<"input another string: "<<endl;
cin>>s2;
}
When I try this:
#include <iostream>
using namespace std;
int main()
{
char s1[128], s2[128];
char c;
cout << "input a string: " << endl;
cin.getline(s1, 128);
cout << "input a character: " << endl;
cin >> c;
cout << "input another string: " << endl;
cin.getline(s2, 128);
}
I run into issues... basically when I enter the character it also enters for the second string, and I never get a chance to enter it. please help thanks.
Rik