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(); //类成员函数调用
}
错误:
以上代码的错误只是用了中文的引号而已,这个是超级菜鸟错误……
相关文档:
#include <stdio.h>
#include <windows.h>
#include <mysql.h>
#define host "localhost"
#define username "root"
#define password "123"
#define database "oa"
MYSQL *conn;
int main()
{
MYSQL_RES *res_set;
MYSQL_ROW row;
unsigned int i,ret;
FILE *fp;
MYSQL_FIELD *field;
......
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include ".\sqlite3_lib\sqlite3.h"
static int _callback_exec(void * notused,int argc, char ** argv, char ** aszColName)
{
int i;
for ( i=0; i<argc; i++ )
......
这篇文章是使用SQLite C/C++接口的一个概要介绍和入门指南。
由于早期的SQLite只支持5个C/C++接口,因而非常容易学习和使用,但是随着SQLite功能的增强,新的C/C++接口不断的增加进来,到现在有超过150个不同的API接口。这往往使初学者望而却步。幸运的是,大多数SQLite中的C/C++接口是专用的,因而很少被使用到。尽管有这 ......