0

So basically I have to take in a series of numbers and characters and they would come in like this: "2.1 3 +"

I save this in a char array then I convert it to a string but it only reads the 2.1 and displays that. So I am assuming its only saving the 2.1 in to the string. How do I get it so that my string is "2.1 3 +"?

Here is my code so far:


#include <iostream>
#include <cmath>

    using std::cin;
    using std::cout;
    using std::end;
    using std::string;
    
    int main(int argc, char* argv[]) {
        float o1, o2; 
        string op; 
        char arg[20];
        cin >> arg;
        string command(arg);
        cout << command;
    
    
    }

0 Answers0