The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Very Stupid C++ Question by greyhat2003-02-09 14:52:50
  Umm....What exactly are you trying. by Avium2003-02-09 15:05:58
    Heres what I basically figured out: by greyhat2003-02-09 16:18:32
      Close, but... by treble_clef 2003-02-09 17:38:45
> #include <iostream.h>

//this is not C any more
#include <iostream>

> #include <string>
> using std::string;

using std::cout;
using std::endl;

//won't compile here otherwise.


>int main()

>{
>    string foobar = " ";
>
string foobar; //is equivalent
//string has a default constructor
>     cout << "Enter foobar";
>
>     cin >> foobar;
>
>    cout << foobar;

cout << foobar << endl;

>
>   return 0;
>
>}

A lot of C++ compiles when coded like C... but if you want C, use C. I refer mainly to the fact that C++ headers look like <blah> where C headers look like >blah.h> (except for unix system headers).

[ Reply ]
        Sorry, but I know very little about C/C++ by greyhat2003-02-09 18:10:44

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)