Results 1 to 8 of 8
  1. Spirit of the Arrow Bi Female
    IGN: MariettaRC
    Server: Windia
    Level: 200
    Job: Bowmistress
    Guild: KoopaForce
    Alliance: KoopaEmpire
    Nebraska

    Default Doing some very basic C++ practice.


    And I mean very basic because I'm taking an Object Oriented Programming class and it's currently kicking my ass because last time I had C++ was 3 years ago and they'd done an experimental thing by teaching us about Dark GDK instead of actual C++ so I'm horrible at it (and programming in general) and I don't want to hear any talk about that.

    Anyway;

    Code:
    //Include the input/output stream
    
    #include "stdafx.h" //Compiler needs this line, else it's gonna pomegranate everywhere but I have to take it out before submitting to UNIX.
    #include <iostream>
    using namespace std;
    
    //Main program
    //This program will simply display your name after it's been put in.
    int main ()
    {
    	//Declare variables
    	string name;
    
    	//Ask for name
    	cout << "What is your name? " << endl;
    	cin >> name;
    
    	//Display name
    	//cout << "Your name is " << name << ", is that correct?" << endl;
    	
    	return 0;
    }
    cin >> name; gives me this error;

    "error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'const char [2]' (or there is no acceptable conversion)"

    Errors are so wordy. Is it a syntax issue?

  2. Default Re: Doing some very basic C++ practice.


    Code runs fine.

    Never mind, #include <string>

  3. Spirit of the Arrow Bi Female
    IGN: MariettaRC
    Server: Windia
    Level: 200
    Job: Bowmistress
    Guild: KoopaForce
    Alliance: KoopaEmpire
    Nebraska

    Default Re: Doing some very basic C++ practice.


    Oh, so that's a thing... all right, there we go. Thank you!

  4. Default Re: Doing some very basic C++ practice.


    To get rid of the stdafx.h, create an empty project and not a windows console project.

    Also, using namespace std is evil

  5. Spirit of the Arrow Bi Female
    IGN: MariettaRC
    Server: Windia
    Level: 200
    Job: Bowmistress
    Guild: KoopaForce
    Alliance: KoopaEmpire
    Nebraska

    Default Re: Doing some very basic C++ practice.


    Oh, that explains a lot. We don't even use any specific compiler, but I stuck to using Visual Studio 2008. Thanks. :B

    Also, I gotta use namespace std anyway, otherwise I'll get points deducted off of whatever assignment I have to do.

  6. Default Re: Doing some very basic C++ practice.


    std namespace is fine for a programming exercise. It's when you have a bigger project that you might have to maintain and use the same name in more than one place that it becomes bad.

  7. Default Re: Doing some very basic C++ practice.


    Wow that's terrible.

  8. Default Re: Doing some very basic C++ practice.


    I was also forced to use namespace std for Uni level courses as well. It's pretty freaking retarded. But we got to the point to where we can just use ::std now.

  9.  

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •