lundi 8 mars 2021

How to write a function that takes a string consisting of several integers separated by mathematical operators and compute the result

I tried to make this program but I don't know how to start.

#include <iostream>
using namespace std; 

int GetValues (char * text){
    int total = 0;
    return total;
}

void main (){
    char text [] = "100+120+20";
    int value;
    value = GetValue(text);
    cout << value << endl;
}

Aucun commentaire:

Enregistrer un commentaire