C programe (The first day of the training of cognizant )
2012-12-13 09:09
1226 查看
homework 3
#include<stdio.h> #include<conio.h> #include<stdlib.h> int Max(int[] ,int ); int Min(int[] ,int ); void disOdd(int[],int); void disEven(int[],int); int max,min,i; void main(){ clrscr(); int array[]={57,89,76,25,52,93,67,48,121,98},i; max=array[0]; min=array[0]; printf("highest:%d\n",Max(array,10)); printf("lowest :%d\n",Min(array,10)); disOdd(array,10); disEven(array,10); getch(); } //MAX int Max(int n[],int size){ for( i=0;i<size;i++) if(max<n[i]) max=n[i]; return max; } int Min(int n[],int size){ for( i=0;i<size;i++) if(min>n[i]) min=n[i]; return min; } void disOdd(int n[],int size){ printf("total odd number :"); for( i=0;i<size;i++){ if(n[i]%2==0) printf("%d,",n[i]); } printf("\n"); } void disEven(int n[],int size){ printf("total even number:"); for( i=0;i<size;i++){ if(n[i]%2!=0) printf("%d,",n[i]); } printf("\n"); }
homework 1
write the right world to print out the hello world if(!printf("hello,")) printf("hello,"); else{ printf("world"); }
homework 2
#include<stdio.h> #include<conio.h> #include<stdlib.h> void Bank(int n); void Display(); void menu(); void deposit(float balance); void withdraw(float balance); void checkbalance(); float money=500; void main(){ clrscr(); int n; menu(); while(1==1){ scanf("Enter you choice: %d",&n); Bank(n); } getch(); } void menu(){ printf("1.Deposit \n2.Withdraw\n3.Checkbalance\n4. Quit"); } void Display(){ printf("1.Deposit 2.Withdraw 3. Checkbalance 4. Quit \n"); } void Bank(int n){ if(n==1){ printf("Your balance is :%f",money); printf("Amount deposited Successfully !\n"); Display(); }else if(n==2){ printf("You balance is :%f\n",money); Display(); }else if(n==3){ printf("You balance is :%f\n",money); Display(); }else{ exit(0); } } void deposit(float balance){ money+=balance; } void withdraw(float balance){ money-=balance; } void checkbalance (){ printf("You account money is :%f",money); }
相关文章推荐
- C programe (The second day of the training of cognizant )
- The first day of start learning Thinking in java
- The first day of CSDN!
- The first day of learning Python(第一天学习Python)
- the first day of studying agile principles
- the first day of march
- The First Day of Effective
- The First Day of My Life
- Teamwork(The first day of the team)
- it's the first day of August
- The first day of HTML
- SSRS No Delay for First Report of the Day
- My first day of practical training
- How to Spend the First 10 Minutes of Your Day
- The first day of working--everything is fresh to me--I am a super person!
- 开始学习cpp——the first day of pat
- The first day of learn java
- 87.You want to display the date for the first Mon day of the next month and
- The first day of learning java
- 先把同事的原创贴上 - Tip of the Day --for Using Emacs