Skip to content

Commit aa4d546

Browse files
committed
init
1 parent 276683b commit aa4d546

File tree

11 files changed

+2764
-0
lines changed

11 files changed

+2764
-0
lines changed

ios/个人/GNUmakefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
GNUSTEP_MAKEFILES=/GNUstep/System/Library/Makefiles
2+
3+
include $(GNUSTEP_MAKEFILES)/common.make
4+
5+
TOOL_NAME=main
6+
main_OBJC_FILES=main.m
7+
8+
include $(GNUSTEP_MAKEFILES)/tool.make

ios/个人/W/.inputrc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Key-bindings for the command-line editor.
2+
3+
# Ask before displaying >50 items
4+
# Since $WINDIR $PATH var can be in $PATH, this could list
5+
# all window exectables in C:\WINDOWS
6+
set completion-query-items 50
7+
8+
# Ignore case for the command-line-completion functionality
9+
# on: default to a Windows style console
10+
# off: default to a *nix style console
11+
set completion-ignore-case on
12+
13+
# none, visible or audible
14+
set bell-style audible
15+
16+
# disable/enable 8bit input
17+
set meta-flag on
18+
set input-meta on
19+
set output-meta off
20+
set convert-meta on
21+
22+
# visible-stats
23+
# Append a mark according to the file type in a listing
24+
set visible-stats off
25+
set mark-directories on
26+
27+
# Show all instead of beeping first
28+
set show-all-if-ambiguous off
29+
30+
# MSYSTEM is emacs based
31+
$if mode=emacs
32+
# Common to Console & RXVT
33+
"\C-?": backward-kill-line # Ctrl-BackSpace
34+
"\e[2~": paste-from-clipboard # "Ins. Key"
35+
"\e[5~": beginning-of-history # Page up
36+
"\e[6~": end-of-history # Page down
37+
38+
$if term=msys # RXVT
39+
"\e[7~": beginning-of-line # Home Key
40+
"\e[8~": end-of-line # End Key
41+
"\e[11~": display-shell-version # F1
42+
"\e[15~": re-read-init-file # F5
43+
$endif
44+
$if term=cygwin # Console
45+
"\e[1~": beginning-of-line # Home Key
46+
"\e[4~": end-of-line # End Key
47+
$endif
48+
$endif
49+
50+

ios/个人/gcc.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gcc -o "$1" "$2" -fconstant-string-class=NSConstantString -I/GNUstep/System/Library/Headers -L/GNUstep/System/Library/Libraries -lobjc -lgnustep-base

ios/个人/gnu使用方法.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
make
2+
debug./stud.app
3+
<gdb> r

ios/个人/main.m

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#import<Foundation/Foundation.h>
2+
3+
@interface Contact:NSObject{
4+
NSString *name;
5+
NSString *tel;
6+
NSString *address;
7+
}
8+
-(NSString *)name;
9+
-(NSString *)tel;
10+
-(NSString *)address;
11+
-(void)setName:(NSString *)nameParam;
12+
-(void)setTel:(NSString *)telParam;
13+
-(void)setAddress:(NSString *)addressParam;
14+
-init:(NSString *)nameParam:(NSString *)telParam:(NSString *)addressParam;
15+
@end
16+
@implementation Contact
17+
-(NSString *)name{
18+
return name;
19+
}
20+
-(NSString *)tel{
21+
return tel;
22+
}
23+
-(NSString *)address{
24+
return address;
25+
}
26+
-(void)setName:(NSString *)nameParam{
27+
name=nameParam;
28+
}
29+
-(void)setTel:(NSString *)telParam{
30+
tel=telParam;
31+
}
32+
-(void)setAddress:(NSString *)addressParam{
33+
address=addressParam;
34+
}
35+
-init:(NSString *)nameParam:(NSString *)telParam:(NSString *)addressParam{
36+
if((self=[super init])){
37+
name=nameParam;
38+
tel=telParam;
39+
address=addressParam;
40+
}
41+
return self;
42+
}
43+
@end
44+
45+
@interface ContactService:NSObject
46+
+(void)init;
47+
+(void)add:(Contact *)contact;
48+
+(int)find:(NSString *)name;
49+
+(void)del:(NSString *)name;
50+
+(void)showAll;
51+
@end
52+
53+
static NSMutableDictionary *contacts;
54+
@implementation ContactService
55+
+(void)init{
56+
contacts=[NSMutableDictionary dictionary];
57+
}
58+
+(void)add:(Contact *)contact{
59+
[contacts setObject:contact forKey:[contact name]];
60+
}
61+
+(int)find:(NSString *)name{
62+
int i=0;
63+
for(;i<[contacts count];i++){
64+
if([[[contacts objectForKey:[[contacts allKeys] objectAtIndex:i]]name]isEqualToString:name])
65+
return i;
66+
}
67+
return -1;
68+
}
69+
+(void)del:(NSString *)name{
70+
int index=[ContactService find:name];
71+
if(index>=0)
72+
[contacts removeObjectForKey:[[contacts allKeys] objectAtIndex:index]];
73+
}
74+
+(void)showAll{
75+
NSLog(@"****************");
76+
NSLog(@"姓名\t电话\t住址");
77+
int i=0;
78+
for(;i<[contacts count];i++){
79+
Contact *item=[contacts objectForKey:[[contacts allKeys] objectAtIndex:i]];
80+
NSLog(@"%@\t%@\t%@",[item name],[item tel],[item address]);
81+
}
82+
NSLog(@"****************");
83+
}
84+
@end
85+
86+
int main(int argc,const char * argv[]){
87+
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc]init];
88+
Contact *c1=[[Contact alloc]init:@"张三":@"088-222222":@"武汉"];
89+
Contact *c2=[[Contact alloc]init:@"李四":@"088-222222":@"南京"];
90+
Contact *c3=[[Contact alloc]init:@"王五":@"088-222222":@"天津"];
91+
[ContactService init];
92+
[ContactService add:c1];
93+
[ContactService add:c2];
94+
[ContactService add:c3];
95+
[ContactService showAll];
96+
[ContactService del:[c1 name]];
97+
[ContactService showAll];
98+
[pool drain];
99+
return 0;
100+
101+
}
102+
103+
104+

ios/个人/obj/main.exe

44.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)