#include <iostream>
#include <string>
using namespace std;
int main()
{
 int nap;
 cout<<"Milyen nap van ma?\n ";
 cin>>nap;

 if (string nap =="hétfő")
 {
     cout<<"Szar rizzsel";
 }


 return 0;
}

I just begun to explore the wonders of C++. I'm trying to write a simple code but I always run into errors. Please help me fix the code so it will work. I want the program to ask me "what day is today" and then when I type in "monday" it should say "potato" :)
and so on with the rest of the days :)

Recommended Answers

Line 6: should be using a string not an int. string nap;

Line 10: get rid of the string decleration. if (nap == "hétfő")

That should clear up some of your errors.

Jump to Post

All 2 Replies

Line 6: should be using a string not an int. string nap;

Line 10: get rid of the string decleration. if (nap == "hétfő")

That should clear up some of your errors.

Thank you ^^ it works can't belive it was this easy :D

Be a part of the DaniWeb community

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