Exercise 24

// Define a function identifier bit max
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int MAX (A int, int B) {
 IF (A> B) {
  return A;
 }
 the else
  return B;
}
int main () {
 int A, B;
 the printf ( "enter two numbers compare");
 Scanf ( "% D% D", & A, & B);
 int max = mAX (A, B);
 the printf ( "% D \ n-", max);
 System ( "PAUSE");
 return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main () {
 int NUM;
 int Score [10] = 98 {, 45, 65, 76, 78, 96, 93, 81, 94, 92};
 NUM = the Averaging (Score);
 the printf ( "% D \ n-", NUM);
 System ( "pause");
 return 0;
}
int Averaging(int score[10]){
 int num=0;
 for (int i = 0; i < 10; i++){
  num =  num+score[i];
 }

/ * # DEFINE _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
// Output System Date and Time
int main () {
 int Command [. 4] = {0,. 1, 2 ,. 3};
 int NUM;
 struct (TM) * systime;
 the printf ( "need assistance, please enter 0 \ n-");
 the printf ( "Please enter your instruction \ n-");
 the while (. 1) {
  Scanf ( "% D", NUM &);
  IF (Command [0] == NUM) {
   the printf ( "date input digital display system, an input digital display system 2, an input digital exit system 3 \ n");
  }
  else if (command[1] == num){
   time_t nowtime;
   time(&nowtime);
   systime = localtime(&nowtime);
   printf("系统日期:%d-%d-%d\n", 1900 + systime->tm_year, systime->tm_mon, systime->tm_mday);
  }
  else if (command[2] = num){
   time_t nowtime;
   time(&nowtime);
   systime = localtime(&nowtime);
   printf("%d:%d:%d\n", systime->tm_hour, systime->tm_min, systime->tm_sec);
  }
  else if (command[3] == num){
   return 0;
  }
  printf("请输入命令符:\n");
 }
 system("pause");
 return 0;
}*/
 
#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int main(){//输出成绩按大小排列
 int arr[12];
 int i,j;
 int tmp;
 printf("请输入成绩\n");
 for (i = 0; i < 12; i++){
  printf("arr[%d]=",i);
  scanf("%d", &arr[i]);
 }
 for (i = 0; i < 11; i++){
  for (j = i + 1; j < 12; j++){
   if (arr[i] < arr[j]){
    tmp = arr[i];
    arr[i] = arr[j];
    arr[j] = tmp;
   }
  }
 }
 for (i = 0; i < 12; i++){
  printf("%d\t", arr[i]);
  if (i == 3 || i == 7){
   printf("\n");
  }
 }
 system("pause");
 return 0;
}
#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int main(){
 char a[10];
 char b[10];
 int i=0;
 printf("请输入字符串a:\n");
 gets(a);
 while (a[i] != '\0'){
   b[i] = a[i];
  i++;
 }
 b[i] = '\0';
 printf("打印字符串b\n");
 puts(b);
 system("pause");
 
}
#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
main()
{
 char s1[30], s2[30];
 int i = 0;
 printf("请输入字符串1:\n");
 gets(s1);
 while (s1[i] != '\0')
 {
  s2[i] = s1[i];
  i++;
 }
 s2[i] = '\0';
 printf("字符串2:\n");
 puts(s2);
 system("pause");
}

Guess you like

Origin www.cnblogs.com/yuzhenghan/p/12025382.html