C++计算器程序设计
来源:百度知道 编辑:UC知道 时间:2024/06/06 07:10:38
要用VS2005编写的~用C++编 我是C++的入门者~难了会没学的
#include <iostream> // For stream input/output
#include <cstdlib> // For the exit() function
#include <cctype> // For the isdigit() function
using std::cin;
using std::cout;
using std::endl;
void eatspaces(char* str); // Function to eliminate blanks
double expr(char* str); // Function evaluating an expression
double term(char* str, int& index); // Function analyzing a term
double number(char* str, int& index); // Function to recognize a number
const int MAX = 80; // Maximum expression length,
// including '\0'
int main()
{
char buffer[MAX] = {0}; // Input area for expression to be evaluated
cout << endl
<< "Welcome to your friendly calculator."
<< endl