RE: [Dev-C++] RE : [c-prog] what's wrong with the code
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <a_g...@ya...> - 2003-08-12 19:53:12
|
string p =ch; file://does not make much sense to me!!!
Ioannis Vranos <iv...@em...> wrote:> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of Dawood Vora
> Sent: Tuesday, August 12, 2003 4:21 AM
> To: Dev C++
> Subject: [Dev-C++] RE : [c-prog] what's wrong with the code
>
>
> Subject: RE : [c-prog] what's wrong with the code
>
> I tried "using namespace std;" it still gives me error.
> #include
#include
But you do not use any facilities of in your code.
> #include
Better: #include
> #include
>
>
> int main()
> {
using namespace std;
> char ch = 'z';
> string p = ch;
> /* for the above line the following is the error it gives me :
> conversion from `char' to non-scalar type
> `basic_string,__default_alloc_te
> mplate
> >' requested
> */
The above line is wrong. There is no string constructor taking a char as an
argument.
So your code becomes:
#include
#include
int main()
{
using namespace std;
char ch = 'z';
string p;
p.push_back(ch);
system("PAUSE");
return 0;
}
Ioannis Vranos
* Programming pages: http://www.noicys.freeurl.com
* Alternative URL 1: http://run.to/noicys
* Alternative URL 2: http://www.noicys.cjb.net
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
Thanx and Regards
Avik Ghose
Win TVs, Bikes, DVD players and more!Click onYahoo! India Promos |