Categories
C

Student Grading and Information System in C

A database program that I called Student Grading and Information System in C which uses binay file to add, update, view, and delete the student records.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

/* student_system.c 
   Mr. Jake Rodriguez Pomperada,MAED-IT, MIT
   Dev C++
   www.jakerpomperada.com , www.jakerpomperada.blogspot.com
   jakerpomperada@gmail.com
   Bacolod City, Negros Occidental Philippines.
 */
  
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>

main( )
{
	FILE  *fp, *ft ;
	char  another, choice ;
	struct student
	{
		char  stud_id[200];
		char  name[200];
		char  course[200];
		char  sex;
		int   age;
		char  address[200];
		char  email[200];
		char  subject[200];
		float prelim,midterm,endterm,final_grade;
	} ;

	struct student info ;
	char student_id[200];
	int flag=0;

	long int  recsize ;

	fp = fopen ( "BIODATA.DAT", "rb+" ) ;

	if ( fp == NULL )
	{
		fp = fopen ( "BIODATA.DAT", "wb+" ) ;

		if ( fp == NULL )
		{
			puts ( "Cannot open file" ) ;
			exit(0) ;
		}
	}

	recsize = sizeof ( info ) ;

	while (1)
	{
        system("CLS");
        printf("\n");
	    printf("\n==============================================");
        printf("\n");
        printf("\nSTUDENT GRADING AND INFORMATION SYSTEM IN C ");
        printf("\n");
        printf("\n===============================================");
  		printf("\n\n");
		printf ( "1. ADD STUDENT RECORDS") ;
		printf("\n");
		printf ( "2. DISPLAY STUDENT RECORDS" ) ;
		printf("\n");
		printf ( "3. UPDATE STUDENT RECORDS" ) ;
		printf("\n");
		printf ( "4. SEARCH STUDENT RECORDS" ) ;
		printf("\n");
		printf ( "5. DELETE STUDENT RECORDS" ) ;
		printf("\n");
		printf ( "6. QUIT PROGRAM" ) ;
		printf("\n\n");
		printf ("SELECT YOUR CHOICE : ") ;
		fflush (stdin) ;
		choice = getche() ;
		switch (choice)
		{
			case '1' :
				fseek (fp, 0 ,SEEK_END) ;
				another = 'Y' ;

				while ( another == 'Y' )
				{
					system("cls");
					printf("\n\n");
                    printf("=== Add New Student Record in the Database ===");
                    printf("\n\n");
					printf("Enter Student ID             : ");
					scanf("%s",&info.stud_id);
					printf("Enter Student Name           : ");
					fflush(stdin);
					gets(info.name);
					printf("Enter Course                 : ");
					fflush(stdin);
					gets(info.course);
				    printf("Enter Gender M/F             : ") ;
                    info.sex = toupper(getche());
                    printf("\n");
                    printf("Enter Age                    : ") ;
                    scanf("%d",&info.age);
                    printf("Enter Home Address           : ");
                    fflush(stdin);
					gets(info.address);
					printf("Enter Email Address          : ");
					scanf("%s",&info.email);
					printf("Enter Subject                  : ");
					fflush(stdin);
					gets(info.subject);
					printf("Enter Prelim Grade           : ");
					scanf("%f",&info.prelim);
					printf("Enter Midtem Grade           : ");
					scanf("%f",&info.midterm);
					printf("Enter Endterm Grade           : ");
					scanf("%f",&info.endterm);
					info.final_grade = (info.prelim * 0.20) + (info.midterm * 0.30) + (info.endterm * 0.50);
					printf("\n\n");
                    printf("\nFinal Grade         : %2.0f",info.final_grade);
					fwrite ( &info, recsize, 1, fp ) ;
					printf("\n\n");
					printf ("\nAdd another Record (Y/N) : ") ;
					fflush (stdin) ;
					another = toupper(getche()) ;
				}

				break ;

			case '2' :
			    system("cls");
				rewind (fp);
				printf("\n\n");
                printf("=== View the Records in the Database ===");
                printf("\n\n");
		while ( fread ( &info, recsize, 1, fp ) == 1 )
         {
		    printf("\n");
            printf("\n Student ID          : %s",info.stud_id);
	        printf("\n Name                : %s",info.name);
		    printf("\n Course              : %s",info.course);
		    printf("\n Gender              : %c",info.sex);
		    printf("\n Age                 : %d",info.age);
		    printf("\n Home Address        : %s",info.address);
		    printf("\n Email Address       : %s",info.email);
		    printf("\n Subject             : %s",info.subject);
		    printf("\n Prelim Grade        : %2.0f",info.prelim);
		    printf("\n Midterm Grade       : %2.0f",info.midterm);
		    printf("\n Endterm Grade       : %2.0f",info.endterm);
		    printf("\n");
		    info.final_grade = (info.prelim * 0.20) + (info.midterm * 0.30) + (info.endterm * 0.50);
		    printf("\n Final Grade         : %2.0f",info.final_grade);
			printf("\n\n");
        }
            system("pause");
            break ;

			case '3' :
               rewind (fp);

				another = 'Y' ;
				while (another == 'Y')
				{
                    system("cls");
                    printf("=== Update Student Records in the Database ===");
                    printf("\n\n");
					printf("\n");
                    printf("Enter Student ID Number      : ");
					scanf("%s",&student_id);
					rewind (fp) ;
					while (fread( &info, recsize, 1, fp ) == 1 )
					{
                    if ( strcmp ( info.stud_id, student_id ) == 0 )
                    {
                        printf("Enter Student ID       : ");
                        scanf("%s",info.stud_id);
                        printf("Enter Student Name     : ");
                        fflush(stdin);
                        gets(info.name);
                        printf("Enter Course           : ");
                        fflush(stdin);
                        gets(info.course);
                        printf("Enter Gender M/F       : ") ;
                        info.sex = toupper(getche());
                        printf("\n");
                        printf("Enter Age              : ") ;
                        scanf("%d",&info.age);
                        printf("Enter Home Address     : ");
                        fflush(stdin);
                        gets(info.address);
                        printf("Enter Email Address    : ");
                        scanf("%s",&info.email);
                        printf("Enter Subject          : ");
                        fflush(stdin);
                        gets(info.subject);
                        printf("Enter Prelim Grade     : ");
                        scanf("%f",&info.prelim);
                        printf("Enter Midtem Grade     : ");
                        scanf("%f",&info.midterm);
                        printf("Enter Endterm Grade    : ");
                        scanf("%f",&info.endterm);
                        printf("\n");
                        info.final_grade = (info.prelim * 0.20) + (info.midterm * 0.30) + (info.endterm * 0.50);
                        printf("\n Final Grade         : %2.0f",info.final_grade);
                        printf("\n\n");
                        printf("Records has been updated in the database.");
                        printf("\n\n");
                        system("pause");
						fseek ( fp, - recsize, SEEK_CUR ) ;
						fwrite ( &info, recsize, 1, fp ) ;
						break ;
                    }
                }
             if (strcmp(info.stud_id,student_id) != 0 )
                    {
                        printf("\n\n");
                        printf("No Record in the Database.");
                        printf("\n");
                        system("pause");
                        break;
                    }
                    printf("\n\n");
					printf ( "\nUpdate Another Record (Y/N) : " ) ;
					fflush (stdin) ;
					another = toupper(getche());
				}

				break ;

	case '4' :
                rewind (fp);

				another = 'Y' ;
				while ( another == 'Y' )
				{
                    system("cls");
                    printf("=== Search Student Records in the Database ===");
                    printf("\n\n");
				    printf("Enter Student ID       : ");
					scanf("%s",&student_id);
					printf("\n");
					rewind (fp) ;
					while ( fread( &info, recsize, 1, fp ) == 1 )
					{
						if (strcmp(info.stud_id,student_id) == 0 )
						{
                            printf("\n");
                            printf("\n ID Number           : %s",info.stud_id);
                            printf("\n Name                : %s",info.name);
                            printf("\n Course              : %s",info.course);
                            printf("\n Gender              : %c",info.sex);
                            printf("\n Age                 : %d",info.age);
                            printf("\n Home Address        : %s",info.address);
                            printf("\n Email Address       : %s",info.email);
                            printf("\n Subject             : %s",info.subject);
                            printf("\n Prelim Grade        : %2.0f",info.prelim);
                            printf("\n Midterm Grade       : %2.0f",info.midterm);
                            printf("\n Endterm Grade       : %2.0f",info.endterm);
                            printf("\n");
                            info.final_grade = (info.prelim * 0.20) + (info.midterm * 0.30) + (info.endterm * 0.50);
                            printf("\n Final Grade         : %2.0f",info.final_grade);
                            printf("\n\n");
                            system("pause");
                            break;
               		}
				}

            if (strcmp(info.stud_id,student_id) != 0 )
                    {
                        printf("\n\n");
                        printf("No Record in the Database.");
                        printf("\n\n");
                        system("pause");
                        break;
                    }
                    printf("\n\n");
					printf ( "\n Search Another Student Record (Y/N) : " ) ;
					fflush (stdin) ;
					another = toupper(getche());
				}
				break ;

			case '5' :
				another = 'Y' ;
				while ( another == 'Y' )
				{
					system("cls");
					flag=0;
                    printf("=== Delete Student Records in the Database ===");
                    printf("\n\n");
					printf("Enter Student ID       : ");
					scanf("%s",&student_id);
					printf("\n");

    				ft = fopen ("TEMP.DAT", "wb") ;
					rewind (fp) ;
					while (fread (&info, recsize, 1, fp) == 1 )
					{
						if (strcmp(info.stud_id, student_id) != 0 )
							fwrite(&info, recsize, 1, ft ) ;
						else
                            flag=1;
					}

					fclose (fp) ;
					fclose (ft) ;
					remove ("BIODATA.DAT") ;
					rename ("TEMP.DAT", "BIODATA.DAT") ;
					fp = fopen ("BIODATA.DAT", "rb+") ;

                  if(flag==1) {
                        printf("\n\n");
                        printf("Record Successfully Deleted From the Database.");
                        printf("\n\n");
                        system("pause");
                    }

					else if (flag!=1) {
                        printf("\n\n");
                        printf("Sorry Record Not Found in the Database.");
                        printf("\n\n");
                        system("pause");

                    }

                        printf("\n\n");
                        printf( "Delete Another Record (Y/N) " ) ;
                        fflush ( stdin ) ;
                        another = toupper(getche());
				}
				break ;

			case '6' :
				fclose (fp) ;
				printf("\n\n");
				printf("             Thank You For Using This Program !!!   ");
				printf("\n\n");
				system("PAUSE");
				exit(0);
		}
	}
} /* End of Code */
Categories
C

Multiplication Table in C

 A program that I wrote using C language to create a multiplication table.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.

Your support on my channel is highly appreciated.

Thank you very much.

Program Listing

/* 
   multiplication_table.c
   Mr. Jake Rodriguez Pomperada, MAED-IT, MIT
   www.jakerpomperada.com , www.jakerpomperada.blogspot.com
   jakerpomperada@gmail.com
   Bacolod City, Negros Occidental Philippines 
   November 30, 2020   Monday  2:28 PM
*/


#include <stdio.h>


int main()
{
    int row=0,column=0;

    printf("\n\n");
    printf("\t     MULTIPLICATION TABLE IN C\n\n");
    
    for(row=1; row<=12; row++){
        for(column=1; column<=12; column++){
            printf("%4d", row*column);
    }
    printf("\n");
    }
    printf("\n\n");
    printf("\t\tEnd of Program");
    printf("\n\n");
}