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

C\C++菜鸟问题集1

代码:
#include  <iostream>
using namespace std;
class Clock
{
int hour, minute, second;
public:
   Clock(int h, int m, int s) //构造函数定义 ,无返回值类型
   {     
if(s<0) second=0;
       if (s>=60) second =s%60;
   else second=s;
       if(m<0) minute=0;
       if (m>=60) minute =m%60;
    else minute=m;
    if(h<0) hour=0;
       if (h>=24) hour=h%24;
  else hour=h;
}
void print(){ cout<<hour<<”:”<<minute<<”:”<<second<<endl; }
};
void main()
{
    Clock  aClock(100,100,200);
        //创建一个Clock类的对象aClock
    aClock.print();  //类成员函数调用
}  
错误:
以上代码的错误只是用了中文的引号而已,这个是超级菜鸟错误……


相关文档:

SQLite C/C++接口介绍

这篇文章是使用SQLite C/C++接口的一个概要介绍和入门指南。
由于早期的SQLite只支持5个C/C++接口,因而非常容易学习和使用,但是随着SQLite功能的增强,新的C/C++接口不断的增加进来,到现在有超过150个不同的API接口。这往往使初学者望而却步。幸运的是,大多数SQLite中的C/C++接口是专用的,因而很少被使用到。尽管有这 ......

一个用C实现的URL解码的程序

#include <stdio.h>
#include <string.h>
/*
* decode encd with URL, the result saved to decd.
* return point to be decoded string.
* auth: baisoo email:baisoo@msn.com
*/
char *decode( char *encd, char decd[] );
int main( int argc, char *argv[] )
{
    if( argc < ......

C语言函数的出口:return语句(高质量c/c++编程指南)


C语言函数的出口:return语句(高质量c/c++编程指南) 收藏
今天看到了一篇关于c/c++语言中,对于函数出口处:return语句的正确性和效率性的检查问题。平时我们都不太看重return语句的,认为它简单,不是很重要,其实不然,return语句要是写的不好,很容易导致效率低下,甚至会出错!特别是在处理指针时。
下面看看要 ......

static C C++语义

存储期storage duration(extent), 指为对象配置的内存的存活期,比如local extent
生存空间scope,指对象在程序内的存活区域,即可被访问的范围,比如file scope, static scope, local scope
C
local static object
 函数内部的object,具有local scope,但是每次函数被调用后该对象的内存不清理,到下次调用还保 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号