|
-
Oct 20th, 2001, 02:07 PM
#1
Thread Starter
I wonder how many charact
declaring and using strings
I drivin myself up the wall here... I'm using vc++... and all i am tryin to do is declare and use a string variable....
#include <iostream>
#include <string>
void main()
{
string firstBinaryDigit;
string secondBinaryDigit = "h";
cout << "Enter first binary number";
cin >> firstBinaryDigit;
cout << "\nEnter second binary number";
cin >> secondBinaryDigit;
}
but i get this error... it won't recognize string...
:\Windows\Cpp1.cpp(6) : error C2065: 'string' : undeclared identifier
whats up ?
I realize there is Cstring class, but I haven't been able to get that to recognize either.... (plus I need to use the std String class since its intended to run on a unix system...)
-
Oct 20th, 2001, 02:09 PM
#2
PHP Code:
#include <iostream>
#include <string>
using namespace std;
void main()
{
string firstBinaryDigit;
string secondBinaryDigit = "h";
cout << "Enter first binary number";
cin >> firstBinaryDigit;
cout << "\nEnter second binary number";
cin >> secondBinaryDigit;
}
try that.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Oct 20th, 2001, 02:10 PM
#3
Thread Starter
I wonder how many charact
:\Windows\Cpp1.cpp(3) : error C2871: 'std' : does not exist or is not a namespace
C:\Windows\Cpp1.cpp(6) : error C2065: 'string' : undeclared identifier
and thats what i get....
-
Oct 20th, 2001, 02:11 PM
#4
Thread Starter
I wonder how many charact
I removed the .h from the include header statements, and now it worked... man i hate this language... but thanks very much.. it works now...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|