文章
10
粉丝
22
获赞
2
访问
4.3k
#include <iostream>
#include <string>
#include <sstream>
#include <map>
#include <iomanip>
#include <stack>
#include <cctype>
using namespace std;
map<char, double> variables;
double evaluateExpression(string expr);
void readCommand() {
string line;
getline(cin, line); // Read the next line of integers
stringstream ss(line);
char var;
double value;
int i = 0;
for (const auto& pair : variables) {
ss >> value;
variables[pair.first] = value;
i++;
}
}
void assignCommand(string line) {
char var = line[0];
string expr = line.substr(2);
double value = evaluateExpression(expr);
variables[var] = value;
}
void printCommand(string line) {
stringstream ss(line);
char var;
bool first = true;
while (ss >> var) {
if (!first) cout << " ";
cout << fixed << setprecisio...
登录后发布评论
暂无评论,来抢沙发