Can't find tutorial on how to make this program

Jan 1, 2016 at 9:11am
Hi, I need to make a program using C++ in which

if ( String==Joe ) {

cout << "You can drink" << endl;

String is the name which is inputted into the console, I just don't know how to make such a code.

I really hope you guys understand what I'm trying to do here. Basically, if someone inputs their name and its Joe, then it should say "You can drink". I just don't know how to get it to do that.
Jan 1, 2016 at 9:37am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <string> 
#include <cstdlib>

using namespace std;

int main(void)
{
  string input;
  cout << "Enter your name: ";
  cin >> input;
  if (input == "Joe")
    cout << "\nYou can drink.";
  system("pause");
  return EXIT_SUCCESS;
}
Jan 2, 2016 at 12:15am
Not to be rude but you clearly dont even know the basics of c++ But i'd suggest learning here if you want to understand more - https://www.thenewboston.com/videos.php?cat=16
Jan 2, 2016 at 12:17am
To add to @Rootkitee. New Boston was very helpful for me when I was learning, but take it with a pinch of salt. He uses some bad practices. Learn the conceps from him and do stuff with it yourself, find exercises online etc. And use google.
Jan 2, 2016 at 12:32am
Yea thats true @TarolNeaj, also New Boston was very helpful for me too ^^
Jan 2, 2016 at 7:08am
Thanks guys, and yeah @Rootkitee I don't know very much about C++, I'm learning the basics.



Thanks again!!
Jan 2, 2016 at 7:08am
This is my other accout, so yeah I'm Harutyun
Topic archived. No new replies allowed.