摘要:
#include <iostream>#include <windows.h>#include "stdlib.h"#include "time.h"using namespace std;void func(int a[], int n, int K, int (&max)[2]);void main(){ srand(time(0)); int a[10]; int array[2]; for (int i = 0;i<10;i++) { a[i]= rand(); } func(a, 10, 2,array); 阅读全文
posted @ 2012-07-31 15:00
CBDoctor
阅读(209)
评论(0)
推荐(0)
摘要:
代码:#include <iostream>using namespace std;void main(){ int a = 12; int num = 0; while(1) { if(a!=0) { num++; a = a & (a-1); } else break; } cout<<num<<endl; }给定另一个正整数A、B。问你把A变为B需要改变多少为?#include <iostream>#include <windows.h>using namespace std;void main(){ int a = 1 阅读全文
posted @ 2012-07-31 13:38
CBDoctor
阅读(162)
评论(0)
推荐(0)
摘要:
二维数组和指向指针的指针一道面试题引发的问题,首先要知道[]的优先级高于*,题目:char **p,a[6][8]; 问p=a是否会导致程序在以后出现问题?为什么?直接用程序说明:#include<stdio.h>void main(){ char **p,a[6][8]; p = a; printf("\n");}编译,然后就会发现通不过,报错:错误1error C2440: “=”: 无法从“char [6][8]”转换为“char **”《C专家编程》里10.5节—使用指针向函数传递一个多维数组。方法一,函数是 void fun(int arr[2][3] 阅读全文
posted @ 2012-07-31 10:16
CBDoctor
阅读(731)
评论(0)
推荐(0)
浙公网安备 33010602011771号