摘要: AppDelegate.m#import "AppDelegate.h"@implementation AppDelegate- (void)dealloc{ [_window release]; [super dealloc];}- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[[UIWindowalloc] initWithFrame:[[UIScreenmainScre 阅读全文
posted @ 2013-03-22 17:13 沉默的影子 阅读(135) 评论(0) 推荐(0)
摘要: 建King、Worker、Farmer类,由King发送一个自定义通知Worker和Farmer类监听通知,通知内容为打印“国王万岁”。答案 创建 king king.h文档中输入#import <Foundation/Foundation.h>@interface King : NSObject-(void)sendMessage;@end king.m文档中输入 #import "King.h"@implementation King-(void)sendMessage{ [[NSNotificati... 阅读全文
posted @ 2013-03-19 18:04 沉默的影子 阅读(153) 评论(0) 推荐(0)
摘要: 1.现有如下定义的字符串: NSMutableString * str=@“iphoneAndroid”,能不能对该字符串进行修改,如果能,请输出删除Android后的新字符串。 2求字符串“158”和“39”按十进制数值做差后的结果以字符串形式输出 3取出符串“123-456-789-000”中的数字部分,组成一个新的字符串输出,(提示:可变字符串;返回数组) 4放四个十进制三位数到一个数组中,然后按从小到大排序后组成一个新的数组答案:#import "KAppDelegate.h"@implementation KAppDelegate- (void)dealloc{ 阅读全文
posted @ 2013-03-19 17:52 沉默的影子 阅读(450) 评论(0) 推荐(0)
摘要: #include <stdio.h>//声明pi=3.14#define PI 3.14int main(int argc, const char * argv[]){ /* int a = 10; int b; b = 11; //控制台输出 printf("a = %d\nb = %d",a,b); float pi =3.14; double pi_2 = 3.1415926; printf("pi = %f\n pi_2 = %.2f",pi,pi_2); //char char d = 'a'; printf(&qu 阅读全文
posted @ 2013-03-09 17:57 沉默的影子 阅读(137) 评论(0) 推荐(0)
摘要: #include <stdio.h>#include <string.h>// 冒泡排序void popo(char *str[] ,int len);void popo(char *str[] ,int len){ for (int i = 0; i< len - 1; i++) { for (char **m = str; m < str + (len - 1 - i); m++) { if (strcmp(*m, *(m+1)) > 0) { char *tmp = *m; *m = *(m+1); *(m+1... 阅读全文
posted @ 2013-02-27 17:39 沉默的影子 阅读(190) 评论(0) 推荐(0)
摘要: #include <stdio.h>#include <stdbool.h>#include <stdlib.h>#include <time.h>struct Year{ int year; int month; int day;};bool leapYear(int aYear);bool leapYear(int aYear){ bool s = false; if (( aYear % 4 == 0 && aYear % 100 !=0)||(aYear % 400 == 0)) { s = true; } return 阅读全文
posted @ 2013-02-27 17:38 沉默的影子 阅读(172) 评论(0) 推荐(0)
摘要: #include <stdio.h>#include <stdbool.h>bool leapYear(int year);int maxCommonDivisor(int n1,int n2);int main(int argc, const char * argv[]){ // 求三个数最大值 int a = 12,b = 11,c = 9; int max = a; if (max < b) { max = b; } if (max < c) { max = c; } printf("max = %d",max); // 2、 in 阅读全文
posted @ 2013-02-27 17:37 沉默的影子 阅读(129) 评论(0) 推荐(0)
摘要: #include <stdio.h>#define count 100#define max(a,b) (a>b) ? a : b// 函数的声明int getMax(int a,int b);void print(void);// 定义一个枚举enum weekday{ monday = 0, tuesday, wednesday, thusday, friday};int main(int argc, const char * argv[]){ int a = 10,b = 11; // 一级指针 int *p = &a; int *q = &b; // 阅读全文
posted @ 2013-02-27 17:36 沉默的影子 阅读(138) 评论(0) 推荐(0)
摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>int main(int argc, const char * argv[]){ int arr[] = {147258}; // 数组元素的个数 int len = sizeof(arr) / sizeof(arr[0]); for (int i = 0; i < len; i++) { printf("%d ",arr[i]); } printf("\n"); // 声明指针变量 int *p = 阅读全文
posted @ 2013-02-27 17:35 沉默的影子 阅读(124) 评论(0) 推荐(0)
摘要: #include <stdio.h>void changValue1(int x,int y);void changValue1(int x,int y){ int tmp = 0; tmp = x; x = y; y = tmp;}void changValue2(int *x,int *y);void changValue2(int *x,int *y){ int tmp = 0; tmp = *x; *x = *y; *y = tmp;}// 多返回值的函数int calc(int a,int b,int *c);int calc(int a,int b,int *c){.. 阅读全文
posted @ 2013-02-27 17:34 沉默的影子 阅读(141) 评论(0) 推荐(0)