i dont know if anyone experienced this with c++ 6.0 but there is know header called "string". does anyone know how to solve this problem??
if anyone can please give me the contents of the header and ill make it my self.
i dont know if anyone experienced this with c++ 6.0 but there is know header called "string". does anyone know how to solve this problem??
if anyone can please give me the contents of the header and ill make it my self.
what do you mean the header "string" is a problem.
I started out with nothing and I still have most of it left.
and it gives me 1 errorCode:#include <iostream.h> #include <stdio.h> #include <string.h> void main(); { cout<<"a"; return 0; }
error C2447: missing function header (old-style formal list?)
although im starting to think that it isnt the string header.
Not only is void main wrong, I'm sure the ; at the end of the line has something to do with it.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Besides void main:
Non standard header#include <iostream.h>
When compiling as C++
Should be:#include <stdio.h>
#include <string.h>
Code:#include <cstdio> #include <cstring>
a standard sample of using cout function and c++ string type.Code:#include<iostream> #include<string> using namespace std; int main() { string mystring="Hello world !"; cout<<mystring<<endl; return 0; }
i wonder if it is what you need
because i can't get what you mean.....
blow me ... ...
revoletion, here are some things that you should know about strings:
In C++, there are two types of strings and three string-headers.
C-style strings (also called character arrays, or null-terminated strings), are simply an array of ASCII characters with a null (zero) at the end. Note that zero does not represent a printable ASCII character. A zero is represented by a decimal value of 41.... send 41 to your printer and it prints a zero!
You do not need to include any headers to use C-style strings in your program. The code you posted doesn't need it. The two headers <cstring> and the "old" <string.h> are essentially identical. They have handy functions for mainipulating C-style strings. The cprogramming.com string tutorial uses C-style strings and <cstring>.
Hermitsky's example uses a C++ string object which requires the <string> header. The <string> header contains a set of functions for manipulating string objects. (These functions are completely different than the functions in <cstring>.) C++ string objects are generally easier to use (and safer) than C-style strings, but they are more complex "under the hood".
The three string headers are standard, and are included with every C++ compiler. You cannot generally mix-and-match header files between compilers. There is some information about this in the Programming FAQ.if anyone can please give me the contents of the header and ill make it my self.
Just for fun, here are the string header files for the open-source Watcom compiler: (I added the .txt extension so that they all could be uploaded.)