I need help with a C++ code, i am new

So i wanted to write a code that would take 3 user inputs and return the biggest one in a string sentence. I am following a tutorial, but got a bit ahead of myself. Any help apprecieted. Also i only get 1 as output.
Here is the code:

#include <iostream>
using namespace std;
int getmax(int num_1, int num_2, int num_3){
       int MAX;

       if(num_1 > num_2 && num_3){
               MAX = num_1;
       } else if(num_2 > num_1 && num_3){
               MAX = num_2;
       } else if(num_3 > num_2 && num_3){
               MAX = num_3;

       return MAX;

int main()
    int num_1;
    cout << "Player one, enter your name...";
    cin >> num_1;
    int num_2;
    cout << "Player two, enter your name...";
    cin >> num_2;
    int num_3;
    cout << "Player three, enter your name...";
    cin >> num_3;

    cout << getmax;
    return 0;

This doesn’t do what I think that you think it does. && should be used to join independent logical conditions.

Will C++ automatically convert this string input to an integer for you? I’d double check.

Side note - you generally won’t use ALL CAPS for variable names in C/C++. ALL CAPS is for global constants or macros.

But umm, i dont know how to convert a string to a integer, or reversed. I guess i will follow a different tutorial as the one i am following is to basic.
Can you tell which fault i made so i can note it?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.