Okay, a friend of mine is helping me with strings but I'm using VC++ and he's using natural C++ he doesn't know anything about VC so can someone help me convert this over to VC++?
Code:
#include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;
int main()
{
string str1 = "this is a string ";
cout<<str1<<endl;
}
Much thanks.
Try
Code:
cout<<str1.c_str()<<endl;
Originally Posted by SeptFicelle
Okay, a friend of mine is helping me with strings but I'm using VC++ and he's using natural C++ he doesn't know anything about VC so can someone help me convert this over to VC++?
Code:
#include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;
int main()
{
string str1 = "this is a string ";
cout<<str1<<endl;
}
Much thanks.
Rest is the same, just convert the str using c_str() !!
Code:
#include <iostream>
using namespace std;
int main()
{
string str1 = "this is a string ";
cout << str1.c_str() << endl;
system("pause");
}
What.. VC++ is just an IDE, the language is the same.. There is no 'converting' but the compiler that VC++ uses does support some things that others may not, like inline assembly.