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.

Recommended Answers

All 5 Replies

this

'monday'

should be

"monday"

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.

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.