Youth Like Program

青春的轨迹,完全可以用程序来描述。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# include <stdio.h>
# include <stdbool.h>
# include <stdlib.h>

# define FAILURE YOU_ARE_HELL_STEAD_GOES_ON_YOUR_DEATH
# define ED YOU_ARE_IMPROVED
# define ING YOU_ARE_IMPROVING
# define AMABE	ALL_MEN_ARE_BORN_EQUAL

typedef struct your_life {
	unsigned long long study ;
	unsigned long long persist ;
	struct your_life * better_next ;
} you_t ;

bool is_find_rediculous( you_t, you_t ) ;
bool is_discrepancy( you_t, you_t, you_t ) ;

int main( void ){
	you_t you_in_yesterday,
	you_t you_in_today,
	you_t you_in_tomorrow ;

	char flag[8] = "" ;
	char start[6] = "AMABE" ;

	you_t you ;
	you.study = 0 ;
	you.persist = 0 ;
	you -> better_next =start ;
	
	if( is_rediculous( you_in_yesterday, you_in_today )  ){
		flag = "ED" ;
	}
	
	if( is_rediculous( you_in_today, you_in_tomorrow ){
		flag = "ING" ;
	}
	
	if( ! is_discrepancy( you_in_yesterday, you_in_today, you_in_tomorrow ){
		flag = "FAILURE" ;
	}

	if( flag == "ED" && flag == "ING" ) {
		you = you -> better_next;
		you.study ++ ;
		you.persist ++ ;
	} else {
		printf( "\nYOU ARE A LIFE LOSER.\n" ) ;
		exit( -1 ) ;
	}
	
	return 0 ;
}

is_find_rediculous( you_t you_pre, you_t you_after ){
	if( you_after.study > you_pre.study && you_after.persist > you_pre.persist ) {
		return true ;
	} else {
		return false ;
	}
}

is_discrepancy( you_t you_pre, you_t you_now, you_t you_after ){
	if( you_pre.study >= you_now.study || you_now.study >= you_after.study || you_pre.study >= you_after.study ) {
		return true ;
	} else if( you_pre.persist >= you_now.persist || you_now.persist >= you_after.persist || you_pre.persist >= you_after.persist ) {
		return true ;
	} else {
		return false ;
	}
}

本文最后修改时间: 2014年09月18日 18:01:44 (完) CC BY-NC-ND 3.0

若您发现文章中的错误,并愿告知于我,或想与我交流,我的联系方式在: Contacts


上一篇 12334556

All The Best

下一篇 Linux Grub