03 2013 档案
摘要:1 int myatoi(char* str) 2 { 3 int ret=0; 4 int sign = 1; 5 if(*str=='-')//指针的值不是负数 *是取值的意思 &取地址的意思 6 { 7 sign=-1; 8 }else 9 {10 ret=ret*10+(*str-'0');//通过ascii码转换11 }12 str++;13 while(*str!='\0')//指针字符串结尾,不到结尾就循环每一个字符14 {15 16 ret=re...
阅读全文
摘要:看了两章不到。。随意记录下。#include<iostream>#include<string>using std::cout;using std::endl;double calculation(double a,double b,char op){ switch(op) { case '+': return a+b; case '-':return a-b; case '*':return a*b; case '/':return a/b; } } double num=0; double num2=0
阅读全文