Menu

Newbie

2008-04-16
2012-09-26
  • Nobody/Anonymous

    Hi. I am a newbie to c++ (and general programming). I am using the book c++ for dummies all in one guide. I am having problems compiling a code with headers. I have taken the code straight from the book and it still wont compile.

    This is the code:

    main.cpp

    include <cstdlib>

    include <iostream>

    include <stdlib.h>

    include <string>

    include "safestuff.h"

    using namespace std;

    int main(int argc, char *argv[])
    {
    cout << "Surprise, surprise!" << endl;
    cout << "The combination is (once again)" << endl;
    cout << SafeCracker(12) << endl;
    system("PAUSE");
    return 0;
    }

    safestuff.cpp

    include <string>

    using namespace std;

    string SafeCracker(int SafeID) {
    return "13-26-16";
    }

    safestuff.h

    string SafeCracker(int SafeID);

    has anyboy got any idea what i am doing wrong. any help would be appreciated.

     
  • DARC

    DARC - 2011-06-14

    Your format is all wrong. Why do you want to crack safes? Prison is no fun.

     

Log in to post a comment.