I made a program to write and save notes.
يتكون الكود من الجزئين التاليين:
الجزء الأول: يقوم بطباعة قائمة الخيارات واستلام اختيار المستخدم.
الجزء الثاني: يحتوي على حلقة while لتكرار البرنامج وتنفيذ الإجراءات المختلفة حسب اختيار المستخدم.
The code is structured as follows:
Header Files: The necessary header files, stdio.h and string.h, are included at the beginning of the code.
Constants: Two constants are defined using the #define directive. MAX_NOTES represents the maximum number of notes that can be stored, and MAX_NOTE_LENGTH represents the maximum length of each note.
Global Variables: The notes array is declared as a global variable to store the user's notes.
Main Function: The main function is where the program execution starts. It begins by displaying a menu of options to the user and prompting them for their choice.
While Loop: The program enters a while loop that continues until the user chooses to exit (choice 3).
Switch Statement: Inside the loop, a switch statement is used to handle different user choices.
Case 1: If the user chooses to add a note (choice 1), they are prompted to enter a note. The note is then stored in the notes array if there is an available slot. If the array is full, a message is displayed.
Case 2: If the user chooses to view notes (choice 2), all the stored notes are displayed on the screen.
Default Case: If the user enters an invalid choice, an error message is displayed.
User Input: After each action, the user is prompted again for their choice.
Exit: If the user chooses to exit (choice 3), the program terminates.
اسم المستقل | فادي ا. |
عدد الإعجابات | 0 |
عدد المشاهدات | 4 |
تاريخ الإضافة |