上一页 1 ··· 29 30 31 32 33
摘要: //工程——高精度加法计算by iwaich——2009/10/12//环境——VC2008#include <iostream>#include <string>using namespace std;#define MAX 1000;int main(){ int num1[MXA]; int num2[MAX]; int num3[MAX]; memset(num1,0,sizeof(num1)); memset(num2,0,sizeof(num2)); memset(num3,0,sizeof(num3)); int strenth1; int strenth 阅读全文
posted @ 2009-10-12 22:54 胡.杰 阅读(185) 评论(0) 推荐(0)
摘要: #include <stdio.h>main(){int n=5;char c[5];for(int i=0; i <n; i++){scanf("%c",&c[i]);fflush(stdin);}printf(c);//为什么输出会多出奇怪的字符return 0;} 这是我最初的问题代码,是啊,为什么要输出一些奇怪的字符呢?因为我的数组没有结束字符'/0',就是这个原因!对于字符串我们平常是这样用的c[5]={"iwai"};或者是c[5]="iwai";其中已将包含'/0' 阅读全文
posted @ 2009-06-18 14:57 胡.杰 阅读(169) 评论(0) 推荐(0)
摘要: ________________________________________________________________________________________________________________________________________________strcmp("ha","he")是可以的。 但是如下代码: string str1 = "ha"; string str2 = "he"; strcmp(str1, str2); 会产生如下的ERROR: error C2664: 阅读全文
posted @ 2009-06-18 12:05 胡.杰 阅读(946) 评论(0) 推荐(0)
摘要: #include <stdio.h>void main(){ int *p=NULL; *p=5; printf("%d/n",*p);}这串代码编译时没有错误,但是执行不了,为什么呢?是因为*p的定义,初始化问题,像这样定义是不行的,因为根本就没有明确的给指针变量p指定一个内存区域,只是将整数5的地址给了p。造成了运行时的错误!代码修改:#include <stdio.h>void main(){ int *p=NULL,a; a=5; p=&a; printf("%d/n",*p);} 阅读全文
posted @ 2009-06-18 12:03 胡.杰 阅读(141) 评论(0) 推荐(0)
摘要: ————————————————————————————————————————————————————————————数组越界如果申明int a[5];那么我索引到a[5],a[6]....这些数据是什么样的格式呢?int?还是以int型结构索引?是不是我定义了int型的数组,然后以int型读取从数组起始地址开始的内存区域吗(包括越界区域的读取)?例如我上一贴说到的测试程序:#include <iostream>using namespace std;int main(){ int i; double a[4]; for (i=0;i<7;i++) { a[i]=i; } 阅读全文
posted @ 2009-06-18 11:57 胡.杰 阅读(183) 评论(0) 推荐(0)
摘要: 标 题: 更深入一点理解switch语句及c/c++对const的处理 发信站: BBS 水木清华站 (Thu Feb 24 20:58:16 2005), 站内 更深入一点理解 switch 语句 及 c/c++ 对 const 的处理 谢煜波 前段时间在论坛上看见台湾李维在 < <Borland传奇> > 一书中对windows编程模式中,消息处理部分有如下的一些... 阅读全文
posted @ 2009-06-14 13:09 胡.杰 阅读(337) 评论(0) 推荐(0)
上一页 1 ··· 29 30 31 32 33