我想了解如何读取getline字符串并忽略使用bool函数的任何空格,换行符或制表符。然后,当输入为double或特定字符时,它们将仅调用函数,例如" +, - ,*,/"
#include<iostream>
//#include"inter.h" // You may disregard any functions that would come from inter.h
#include<string>
using namespace std;
bool is_num(string input);
bool is_space(string input);
bool is_oper(string input);
int main(){
string input;
getline(cin,input);
while (cin >> input); // read input until user enters ctrl d
if(input.is_num(input == true) {
// calls a push function from inter.h
}
else if(input.is_space == true){
// ignores any white spaces, tabs or new line and continues to read input
}
else if (input.is_oper == true){
//calls my pop function from inter.h
}
}
bool is_num(string input){
// No idea what would go here
return true;
}
bool is_space(string input){
// No idea what would go here needs to ignore any white space or endl;
return true;
}
bool is_oper(string input){
// No idea what would go here
return true;
}