dimanche 17 novembre 2019

"Expected an expression", if/else c++

I'm going crazy over here because of my if-else statement, and I've looked around for answer and other projects of mine...but I can't see why I get "Expected an expression" error right after my "else" bracket.

I've made a comment in the code where it is.

#include <iostream> 
#include "functions.hpp" 

int main(int argc, char* argv[])
{
    if (argc < 3)
        std::cout << "Too few arguments passed...";

    else
    { //HERE
        int base = atoi(argv[0]);  
        float number = atoi(argv[1]);
        int decimals = atoi(argv[2]);
        std::cout << calculate_log(base, number, decimals);
    }
}

Aucun commentaire:

Enregistrer un commentaire