简言之,就是说你该用typename的地方没用typename,如以下代码1 template void frontInsertion(Cont& ci) {2 copy(a, a + sizeof(a)/sizeof(Cont::value_type),3 front_in...
分类:
其他好文 时间:
2015-07-10 14:53:17
阅读次数:
136
一.const的用途1.定义const常量2.可以修饰函数的形参,返回值,以及函数体。被const修饰的内容可以受到强制保护,防止被意外修改,提高程序健壮性。const 返回值 函数返回值为 const 只有用在函数返回为引用的情况。 函数返回值引用常量表示不能将函数调用表达式作为左值使用。例...
分类:
其他好文 时间:
2015-07-09 19:42:54
阅读次数:
141
#include #include int FindProcess(char *s) //返回此进程运行个数{ int cnt=0; PROCESSENTRY32 pe32; pe32.dwSize = sizeof(pe32); HANDLE hProcessSnap = ...
分类:
系统相关 时间:
2015-07-09 00:18:57
阅读次数:
135
1.首先要知道各类型所占字节,才能知道你所需要定义的变量的类型。#include<stdio.h>intmain(){printf(“char所占字节数为%d\n”,sizeof(char));printf(“short所占字节数为%d\n”,sizeof(short));printf(“long所占字节数为%d\n”,sizeof(long));printf(“longlong所..
分类:
其他好文 时间:
2015-07-08 22:52:36
阅读次数:
144
#include #include #include using std::string;const int maxn = 1000;struct bign{ int len,s[maxn]; bign(){ memset(s, 0, sizeof(s));len =1;} ...
分类:
其他好文 时间:
2015-07-07 16:15:12
阅读次数:
91
#include #include const int maxn =3000;int main(){ int f[maxn]; memset(f, 0, sizeof(f)); int i,j,n;f[0]=1; scanf("%d",&n); for (i=2...
分类:
其他好文 时间:
2015-07-07 11:05:42
阅读次数:
106
// 第一个只出现一次的字符题目:在字符串中找出第一个只出现一次的字符。
// 如输入“abaccdeff”,则输出’b’。
#include
#include
char find_one(char *str)
{
int a[256];
int len = strlen(str);
int i = 0;
memset(a, 0, sizeof(a));
for (i...
分类:
编程语言 时间:
2015-07-06 23:32:36
阅读次数:
156
//在字符串中找出第一个只出现一次的字符。如输入“abaccdeff”,则输出’b’
#include
#include
char OneTime(char * str)
{
int data[256];
char *p = str;
if (*p == '\0')
return '\0';
memset(data, 0, sizeof(data));
while (*p )
...
分类:
编程语言 时间:
2015-07-06 17:56:37
阅读次数:
128
数组:
#include
using namespace std;
//模板函数
template
void dump(T val)
{
cout >>>" << __FUNCTION__ << endl;//内置的宏,打印当前函数的名字
cout << sizeof(val) << ":" << typeid(val).name() << endl;
cout << "<<<<" ...
分类:
编程语言 时间:
2015-07-06 12:18:58
阅读次数:
102
一、sizeofsizeof(...)是运算符,在头文件中typedef为unsignedint,其值在编译时即计算好了,参数可以是数组、指针、类型、对象、函数等。它的功能是:获得保证能容纳实现所建立的最大对象的字节大校由于在编译时计算,因此sizeof不能用来返回动态分配的内存空间的大校实际上,..
分类:
其他好文 时间:
2015-07-04 23:39:26
阅读次数:
206