Strings Needing Help

Posts 1–4 of 4 · Page 1 of 1
Strings Needing Help
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;
Quote Originally Posted by SeptFicelle View Post
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");
    }
Yay, my first C++ program !!
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.
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us