Hello all,
I tried searching for this on Google, but didn''t get any good results, and I can''t search the forums right now, that option is disabled..
Does printf() not work with std::string ''s?
Take this snippit of code for example...
#include <string>
#include <iostream>
using namespace std;
int main()
{
string a;
string b;
cout<<"Enter a word"<<endl;
cin>>a;
cout<<"\n\n Enter another word"<<endl;
cin>>b;
printf("the 2 words were %s and %s",a,b);
return 0;
}
Upon compilation, you get
"The two words were and "
Am I just using the wrong syntax for printf? I normally have only used cin and cout up to this point.
Any help is appreciated!
~~~~~~~~~~~
Chris Vogel
~~~~~~~~~~~