易截截图软件、单文件、免安装、纯绿色、仅160KB

数字表达式求值程序 (c/c++)

一个控制台下的数字表达式求值程序 (c/c++)
源代码见下:
#include <stdio.h>
#include <string>
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <stack>
using namespace std;
//设置运算符优先级的算法
int Priority(const string opera) // 运算符优先级
{
    if(opera=="+"||opera=="-")
 {
  return (1);
 }
 else if(opera=="*"||opera=="/")
 {
  return (2);
 }
 else
 {
  return (0);
 }
}
void MiddlefixToPostfix(vector<string> &ivec1,vector<string> &ivec2)
//中缀表达式到后缀表达式的转换算法,ivec2中存放的是中缀表达式,将其转换为后缀表达式形式存放到ivec2中。
{
 //定义一个存放操作符的栈对象。
    stack<string> operatorstk; 
 
 for(vector<string>::size_type i=0;i!=ivec2.size();++i)
 {
        if(ivec2[i]=="(")
  {
   operatorstk.push(ivec2[i]);
  }
  else if(ivec2[i]=="+"||ivec2[i]=="-"||ivec2[i]=="*"||ivec2[i]=="/")
  {
   if(operatorstk.empty())
   {
    operatorstk.push(ivec2[i]);
   }
   else
   {
    if(Priority(ivec2[i])<=Priority(operatorstk.top()))
    {
        while( operatorstk.empty()==false && operatorstk.top()!="(" )
     {
                        ivec1.push_back(operatorstk.top());
      operatorstk.pop();
     }
     operatorstk.push(ivec2[i]);
    }
    else
    {


相关文档:

高质量C++/C编程指南

http://man.lupaworld.com/content/develop/c&c++/c/c.htm
1. 如果参数是指针,且仅作输入用,则应在类型前加const,以防止该指针在函数体内被意外修改
2. 在函数体的“入口处”,对参数的有效性进行检查
    在函数体的“出口处”,对return语句的正确性和效率进行检 ......

在Eclipse中开发C/C++项目 转帖


C/C++ development with the Eclipse Platform
Pawel Leszek
 
摘要:通过本文你将获得如何在Eclipse平台上开发C/C++项目的总体认识。虽然Eclipse主要被用来开发Java项目,但它的框架使得它很容易实现对其他开发语言的支持。在这篇文章里,你将学会如何使用CDT(C/C++ Development Toolkit),一个在Eclipse平台上最 ......

python31与C交互

1.c调用python:
   实例代码:
main.c调用test.py的
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//main.c
#include <windows.h>
......

Objective C 2.0 属性(Property)

原帖一:http://blog.csdn.net/dotphoenix/archive/2009/05/20/4203075.aspx
原贴二:http://www.cocoachina.com/bbs/read.php?tid-8008.html
@property (参数) 类型 名字;
这里的参数主要分为三类:读写属性(readwrite/readonly),setter语意(assign/retain/copy)以及atomicity(nonatomic)。
assign/retain/copy ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号