Hello all,
I am currently trying to figure out how to set a variable as a string, write to it, and display it on command. I realize this will mosty likely involve an array, however I seem to be getting lost in the headers. Whenever I try to compile I get the following error. test_1.cpp(18): error C2872: 'string' : ambiguous symbol
If I remove the line using namespace std;
and add std:: in front of all the cins and couts then it will work. So my question is, how can I achieve this without having to remove the namespace std, and without having to add std:: in front of the iostreams. Here is my source:
#include "stdafx.h"
#include <iostream>
//which header is for strings?!
#include <fstream>
#include <xstring>
using namespace std;
char string[50];
int main()
{
cout << "Hello you crazy world.\n";
cin >>string[50];
cout<<"Your full name is "<<string[50]<<"\n";
system("pause");
return 0;
}
I have also tried removing the headers I have shown in my source, one by one, to no avail.
Thanks in advance. I will gladly supply more information if I was too vague in my explanation.