Joke Collection Website - Blessing messages - Short message billing c language
Short message billing c language
include
include
Integer N = 2;; //Global variable. The number of students entered will change its value by itself.
Structural students
{
Number of characters [10];
Role name [10];
Floating score [3] "/average shareholding;
} student [200];
/ ******************************* ************************************************** ************* /
Invalid input (structure student t [])//input data
{
INT I,J,K,
System ("CLS");
Printf ("The input is determined by the amount of input data \ nYou have determined some data");
Printf ("Please enter 1 Continue \ nExit the program without entering 0 and change the value of the global variable \ n");
Scanf function ("%d",&a);
(A! = 1 )
Exit (0);
(I = 0; & ltn; + +)
{
System ("CLS"); //Clear the screen BR/& gt;; Printf ("Please enter the number of% d students: \ n", I+1);
Scanf function ("%s", the number of t [i]);
is(j = 0j
if(STRCMP(T【I】。 Number, t [j]. NUM)= 0)// Avoid the same number of students.
{/& gt; -
Of printf ("The number of students already exists, please re-enter:");
Sleep (3000);
Breakthrough;
}
}
is(I = 0; & ltn; + +)
{
System ("CLS");
Printf's ("Please enter the student number% s: (separated by spaces) \ nThe first grade of the second door and the third grade of the second door \ n", t [i] num);
//T【I】。 score【0】= 0,T【I】。 score【 1】= 0,T【I】。 score【2】= 0;
Scanf function ("%s% f% f% f, t [i]). Name,&t [i]. score【0】,score of & t【I】【 1】,score of & t【I】【2】);
AVG。 score【0】+T【I】score【 1】+【I】。 score【2】)/3.0;
}
}
/ ************************************************* ********************************************* /
Comment list (student t [])//Displays all information.
{
Me;
System ("CLS");
Information of printf ("%d students are as follows: \ n \ n", n);
Printf's ("The first student ID name achieves the second, and the third score is average \ n");
(I = 0; I++)
{
(t [I] the number of strlen)! = 0)// Judge whether to end.
printf(“% % S \ t where % S \ t % 5.2f \ t % 5.2f \ t % 5.2f \ t \ t“,
t【I】。 Numbers, t [my name, t [I] score [0], t [I]. score【 1】,T【I】score【2】,T【I】。 Average);
other
Breakthrough;
}
putchar( 10);
}
/ ************* ************************************************** ******** /
Invalid research (student t [])//Student id search information.
{
INT I,Y;
Character [10];
( 1)
{System ("CLS");
Printf's ("Please enter your student number:");
Scanf function ("%s",&s);
is(I = 0; i + +)
{
System ("CLS");
((STRCMP(S,T【I】)。 Num))// If the number of students is found, output it.
{
Printf's ("The grades of students with% student number are as follows: \ n \ n", t [] num);
The name of printf ("Average number of students in the first grade of the second grade \ n" means the third grade);
Printf ("%\ tWhere% s \ t% 5.2f \ t% 5.2f \ t% 5.2f \ t",
T [I]. Name, t [me]. Score [0], t [I] score [1], t [I] [2 points], t [I]. Average);
putchar( 10);
Rest;
}
Otherwise, if((STRCMP(S, t [i]). NUM)! = 0 & amp& ampstrlen(T【I】。 NUM)= 0)// The search is not the final result.
{
Printf ("\ nNo counting information: \ n \ n");
Breakthrough;
}
}
printf(“please * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n“); } output (continue to query and enter carriage return \ n ");
("of printf returns to the main menu, enter 2 and enter \ n");
Output (exit the program and enter any carriage return \ n ");
printf(“please * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n“);
("%d" of scanf,&a;;
(== 1)
Research (student, n);
Otherwise, if (== 2)
Breakthrough;
other
{
System ("CLS");
Printf ("Exit and enter to exit and save data");
Scanf function (&y); of'% d'); BR/& gt; if(= = 1)
Exit (0);
Otherwise, if (Y == 2)
Save (Stu);
other
Lord();
}
}
();
}
/ ******************* ************************************************** ************************* /
Invalid del (student t [])//Delete a student's information.
{
INT I,J,A,Z,Y;
Character b [10];
System ("CLS");
Printf ("Please enter the number of schools you want to delete:);
Scanf function ('%s', b);
(I = 0; i + +)
STRCMP(B,T【。 people)= 0)
Breakthrough;
Otherwise, if((STRCMP(B, t [i]). NUM)! = 0 & amp& ampstrlen(T【I】。 NUM)= 0)
{
Of printf ("number information: \ n \ n");
Sleep (3000);
Breakthrough;
}
(strlen(T【NUM】! = 0)
{
System ("CLS");
Printf ("Please confirm deletion? Enter a carriage return \ n'); /& gt; ("%d",&z) of scanf;
(Z == 1)
is(J = I,J++)
{
(strlen(T【J】)。 NUM)= 0)
Break;
other
{
T【J】= T【J+ 1】;
= N- 1;
}
}
}
System ("CLS");
printf(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n“);
(of printf continues to delete and enter carriage return \ n'); ..... /output ("Return to the main menu and enter \ n");
Printf ("Please exit the program and enter any carriage return \ n");
printf(“please * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n“);
("%d",&a) of scanf;
(== 1)
Stu;
Otherwise, if (== 2)
();
Other BR/. {
System ("CLS");
Printf ("Please exit directly, enter enter, save the entered and exited data, and enter the main menu 22 times \ nIt is recommended to exit the amount saved before, otherwise the data will be lost);
Scanf function ("%d",&y);
(== 1)
Exit (0);
Otherwise, if (Y == 2)
Save (Stu);
other
();
}
} & lt//* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
INT I,J,M,A,Y;
System (* * *
CLS“);
Of printf ("Please enter the number of records added: \ nm =");
("%d",&m) of scanf;
For(I = N, I am n+m; + +)
{
System ("CLS");
Printf's ("Please enter the student's ID #% d's new classmate:+1);
Scanf ("t [i]. NUM);
is(J = 0; ; J + +)
(strcmp (t [] min, t [j] min) = = 0)//Avoid duplicate student numbers.
{
-
Printf's ("The student of this student already exists, please re-enter:).
Sleep (3000);
Breakthrough;
}
}
When (i = n, I
{
(《CLS》);
Printf's ("Please enter the number of students in% s to increase the school: (separated by spaces) \ The name of the third door, the score of the first door, and the score of the second door \ n", t [] num);
//t [i] [0] = 0, the score of t [i]. with【 1】= 0,T【I】。 score【2】= 0;
Scanf function ("%s% f% f% f, t [i]). Name,&t [i]. score【0】,score of & t【I】【 1】,score of & t【I】【2】);
AVG。 Score [0]+t [i] Score [1]+[i] [2 points])/3.0;
}
N = N+m// The number of students is equal to the number of students already born plus the number of newly added students.
printf(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n“); & lt/output ("add", enter a carriage return, \ n ");
Of printf ("Go back to the main menu, enter 2 and enter \ n");
("of printf exits the program and enters any carriage return \ n");
printf(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n“);
("%d" of scanf,&a;;
(= = 1)/》; Add (Stu);
Otherwise, if (== 2)
();
other
{
System ("CLS"); ....../& gt; Printf ("Do you want to quit? After entering, enter the car at Exit 2, save the data, and enter the main menu 22 times \ nI I suggest you save some before exiting, otherwise the data will be lost ");
if scanf‘s(“% d“,& y)(y = = 1)
Exit (0);
Otherwise, if (Y == 2)
Save (Stu);
other
Mainly ();
}
}
/ ************ ************************************************** ******************************** /
Integer save (student t [])//file to save data.
{
FILE * FP
CHar【20】,ch;
I am a, y;
System ("CLS");
Printf ("Please save to a new file and enter enter, \ nSave the existing file and enter 2 \ n");
("%d",&a) of scanf; about
CH = getchar function()// Receive carriage return, otherwise, you will get the error that () function space is allocated.
if(a = = 1)
{
Output ("Please enter a new file name: \ n (including extension, no more than 20 characters) \ n");
Obtain;
((fopen (s) of FP = (s, "w+") = = null)//The file pointed by FP.
{
printf(“this file \ n“);
Exit (0);
}
}
Otherwise, if (== 2)
{
Printf ("Please enter an existing file name: \ N (including an extension of no more than 20 characters) \ n");
Obtain;
((FP = FOPEN(“w+“)= = NULL)
{
System (CLS) ";
printf(“Please \ n“; };
Exit (0);
}
}
A file written with fprintf(FP) instead of file "%%d \ N", N)//
is(I = 0; I++)
T [I] of strlen. NUM)! = 0)// If the number of students is not empty, write the data to the specified file.
{
fprintf(FP,“% S \ T % S \ T %-5.2f \ T % 5.2f \ T % 5.2f \ T % 5.2f“,
t【I】。 Serial number, t []. , t [] [0], t [I] score [1], t [I] score [2], t [I] average);
fprintf(FP,“\ n“);
}
other
;
FCLOSE(FP);
System ("CLS"; );
Printf ("Please \ nSave it, and then it's done! \ n“);
}
/ * ************************************************** ******************************************* /
Invalid reading (student t [])//Reading file data.
{
FILE * FP
Explain y, m, I, x;
CHar【20】,ch;
CH = getchar function()// receives the input character, otherwise, the () function space is allocated to s.error..
System ("CLS");
Printf ("Please enter the file name of the data to be read: \ n (including its extension, 20 characters or less) \ n");
Obtain;
((FP = FOPEN(“R“))= = NULL)
{
System ("CLS");
printf(“Please this file \ n“);
Sleep (3000)
System ("CLS");
Printf ("Please exit? Exit and enter to save the data entered in Exit 2, and enter 22 to return to the main menu \ nI I suggest you save the number before exiting, otherwise the data will be lost ");
(“%d“,& y of scanf
(Y == 1)
Exit (0);
Otherwise, if (Y == 2)
Save (
other
();
}
fscanf(FP,“%d“,& x); //Number of registered students
(Stu); I = 0; I x, i++)// Read all data.
The name of fscanf(FP, "%f% f of% s% s, t [i] min, t [i],&t [i]. Score [0],
The score is&t [i] [1],&t [i]. Score [2],&t [I]. Average);
FCLOSE(FP);
System ("CLS");
N-= N//n will be set to 0.
n = X;
Printf ("\ nReading finished! \ n“);
}
/ ******** ************************************************** ************************************ /
Menu()// Select menu BR/& gt;; {
Explain x;
Of printf ("Please select the corresponding menu: \ n");
printf(“* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n“);
("Please enter a new record, enter 0 and enter \ n").
& gtPrintf ("All students, please enter \ n");
Printf ("Please query the corresponding record, enter 2 and enter \ n");
Printf ("Please delete the corresponding record, enter 3 and enter \ n");
("of printf adds a new record and enters 4 input \ n");
Printf ("Record read from file, enter 5, enter \ n");
Printf ("Please rank and output from highest to lowest on average, enter 6 and enter \ n");
Printf ("student ID from low to high, and output, input 7 input \ n");
& gtOutput (the course with the highest score in each course, enter \ n ");
("the score of printf is saved to text input 9 input \ n");
("of printf exits the program, enter 1 1, enter \ n");
printf(“please * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \ n“);
Scanf ("%d" and x);
Returns x;
}
/ ***** ************************************************** *************************************** /
Invalid to _ exit()//exit.
{
Interpretation;
System ("CLS");
Printf ("Please exit directly, enter and save the data, exit input 2 and enter the main menu 22 times \ nI suggest you save the number before exiting, otherwise you will lose the data");
(“%d“,& y of scanf
(Y == 1)
Exit (0);
Others (Y == 2)
Save (Stu);
other
(); ....../& gt; }
/ ****************************************** ************************************************** * /
Invalid avg _ arrange (student t [])//Average high to low sort.
{
I、J;
Structural student temperature [1]; BR/& gt; (I = 0; I<n-1; i + +)
(J = I + 1,J <n,J + +)
(T【I】)。 AVG & lt; t【J】。 Average)
{
TEMP【0】= T【】;
T【】= T【J】;
Ton [j] = temp [0];
}
List (Stu);
}
/ ******************** ************************************************** ************************ /
Invalid num _ arrange (student t [])//The order of the number of students from small to large.
& gt{
Unscramble ij;
Structural student temperature [1];
is(I = 0; I & ltn;; I++)
(J = 0、J & ltN- 1,J + +)
(STRCMP(T【J】)。 Number, t [j+1]. NUM)& gt; 0)
{
Temperature [0] = t [j].
T【J】= T【J+ 1】;
= TEMP【0】in T【j+ 1】;
}
List (t);
}
/ **************************************** ************************************************** **** /
Invalid high (student t [])//Search subjects scored the highest.
{
INT I,J,K,
Structure gives birth to the most [1];
Maximum value [0] = t [0];
System ("CLS");
Printf ("Please enter the subject you are looking for: 1 or 2 or 3 \ n");
Scanf functions (&k of'% d');
(I = 1; I
Maximum value [0] = [0]. score【K- 1】》; T [I] [k-1] has the largest score [0]: [I]
System ("CLS");
Output (the subject of "%d is divided into: the number of students in% %5.2f is \ n", the highest score of k [0] is [k- 1], and the highest score is [0] num);
}
/ ********************************************* ************************************************* /
()
{
Explained;
( 1)
{
A menu ();
Switch (A)// Select the menu according to the corresponding action.
{
In this example, 0: input (stu); Breakthrough;
Case 1: list (stu); Breakthrough;
Case, research (Stu); Breakthrough;
Case 3: Del (Stu); Breakthrough;
Situation 4: Add (Stu); Breakthrough;
In case, 5: reading (Stu); Rest;
Scenario 6: avg _ arrange (stu); Breakthrough;
Case 7: num _ arrange (stu); Breakthrough;
Case 8: Stu; Breakthrough;
Situation: Save (Stu); Breakthrough;
Default value: to _ exit ();
}
}
}
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- Related articles
- What does it mean to sign on behalf of others?
- Please, Apple's text message hasn't been sent. What is the reason?
- I received a text message on my mobile phone.
- What nostalgic songs are worth recommending?
- How to check the credit card balance of CCB by SMS?
- My bank card is bound to my mother's mobile phone number. If I want to buy something on Taobao, will I send a message to my mother? Besides, I am
- Good night sentence that makes your girlfriend happy.
- What changes have taken place in the island map since the appearance of "Peace Elite" Island 2.0?
- Guangzhou bank card limit 1000
- How to write Java short message interface