* key9:
Hi all
Hi hi!
on reading code I found these function
int foo(int char);
char foo(char ch_);
string foo(string ch);
I know the different between char and the string
char[]: 'this is char\0'
string: 'this is string'
Well, almost. If the idea is that a char /array/ is zero-terminated,
then you have it almost right. It's not necessarily zero-terminated (in
fact there are zillions of string formats), but the most common format,
and the one you get for a literal string constant such as "uhuh", is
zero-terminated.
Example (off the cuff):
#include <cstdio // strlen
#include <iostream // cout
#include <ostream // <<, endl
#include <string // string
int main()
{
using namespace std;
char const s[] = "uhuh";
string const t = s; // Copy, in std::string format.
cout << sizeof( s ) << endl; // 5, not 4.
cout << strlen( s ) << endl // 4.
cout << t.length() << endl; // 4.
}
What about int?
It's an integer type. You can do integer arithmetic.
Also
How to corvent string to double, for example
string: 12.0317 to double
boost::lexical_ cast
Install the Boost library.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?