#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

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.