Hello daniweb!
i have recently started to learn c++ and have made a few programs, (a hello world and a multiplication program) following some tutorials. So i decided to try and make my own, but it did not go well. After debugging in microsoft visual c++ 2010 i got loads of errors, and i am not sure what i have done wrong.

//Revision times generator

#include <iostream>
#include <string>
using namespace std;

int main () {

    string day;

    cout << "What day is it today?";
    getline(cin, day);
    if (day == 'monday') {
        cout << "you should revise computing today." << endl;
    } else if (day == 'tuesday') {
        cout << "you should revise math today." << endl;
    } else if (day == 'wednesday') {
        cout << "you should revise biology today." << endl;
    } else if (day == 'thursday') {
        cout << "you sould revise modern studies today." << endl;
    } else if (day == 'friday') {
        cout << "you should revise french today." << endl;
    } else if (day == 'saturday') {
        cout << "you should revise chemistry today." << endl;
    } else if (day == 'sunday') {
        cout << "take a break today." << endl;
    } else
        cout << "no valid day entered." << endl;

    system ("pause");
    return 0;

any help would be great.

Edited by Vv IVIatthew vV: n/a

6 Years
Discussion Span
Last Post by gerard4143



should be


Strings are enclosed with double quotes not single quotes...

If your learning C++ then please get yourself a good book on the subject...Tutorials just don't cut it.

Edited by gerard4143: n/a


thanks for your help, could you reccomend any good c++ books?

Depends...Are you a complete programming rookie or do you know how to program in other languages besides C++.


i'm a complete rookie

Then don't get Accelerated C++ as a first book...as a second yes but not as a first..

I think you can still get "Teach Yourself C++ in 21 days" by googling...The book is a bit dated but its still a good read for the rookie.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.