Quiz Game in C with Source Code

This quiz game mini project in C is a consoled based application created using c programming language. This system is a simple mini project and compiled in Code::Blocks IDE using GCC compiler.

In this project, the user is asked a series of questions and is offered a monetary prize for each accurate answer.

In a quiz game, the questions are chosen to encompass all aspects of a traditional quiz competition.

Quizzes on science, technology, movies, sports, general health, geography, and other topics put the user’s general knowledge to the test.

quiz game project in c language with source code is an easy project for beginners to learn how to build a web-based C language project.

We will provide you with the complete source code for the C project so that you can easily install it on your machine and learn how to program in C language.

This Quiz in C Framework, Also includes a Download Source Code for free, just find the downloadable source code below and click download now.

Anyway if you want level up your knowledge in programming especially C/C++ Programming Language, try this new article I’ve made for you Best C Projects with Source Code for Beginners Free Download.

To start creating a quiz game project in c language with source code, make sure that you have a Code Blocks or any platform of C installed in your computer.

ABOUT PROJECTPROJECT DETAILS
Project Name : Quiz Game
Project Platform :C/C++
Programming Language Used:C Programming Language
Developer Name :itsourcecode.com
IDE Tool (Recommended):Dev-C++/Codeblocks
Project Type :Desktop Application
Database:Stores data in .DAT file
Quiz Game in C with Source Code Overview

Features of Quiz Game mini project in C with Source Code

  • modify score – adds the current monetary award received to the previous one when a question is correctly answered.
  • help – a help menu with an explanation of the game and its rules.
  • show score – displays the highest score/cash prize earned by a specific user.
  • show record – displays the highest cash prize won by a specific user show.
  • score – displays the highest score/cash prize won by a specific user.

Quiz Game mini project in C Steps on How to Create a Project

Time needed: 5 minutes

Here’s the step’s on how to create a Quiz Game in C with Source Code.

  • Step 1: Create a new project.

    First open the code blocks IDE and click “create a new project“.
    Create a Project For Quiz Game in C with Source Code

  • Step 2: Choose console application.

    Next, click the “console application” and after that click “next“.
    Create a Project For Quiz Game in C with Source Code

  • Step 3: Choose C language.

    Then , choose “C language” and click “next“.

  • Step 4: Name your project.

    Lastly, name the project you’ve created and click “next” after that click “finish“.

  • Step 5: The actual code.

    Finally, we will now start adding functionality to our C Framework by adding some functional codes.

Functionality and Codes of the quiz game project in C language with source code

  • Create to add stdio library in Quiz Game Project in C.

Before we can manipulate inputs and outputs, we must first add the stdio library:

#include <stdio.h>
#include <stdlib.h>

  • Create main menu in Quiz Game Project in C.

Function on how to create a mean menu in quiz game.

int main()
     {
     int quizCounters,r,r1,countingQuiz,i,n;
     float countingScores;
     char options;
     char playername[20];
     mainhome:
     system("cls");

     printf("\n\t\t****************************************");

     printf("\n\t\t\t   WELCOME TO QUIZ GAME");

     printf("\n\t\t****************************************");
     printf("\n\t\t****************************************");
     printf("\n\t\t   CARLOS HILADO MEMORIAL STATE COLLEGE") ;
     printf("\n\t\t****************************************");
     printf("\n\t\t****************************************");
     printf("\n\t\t Enter 1 to start the game");
     printf("\n\t\t Enter 2 to view the highest score  ");
     printf("\n\t\t Enter 3 to reset score");
     printf("\n\t\t Enter 4 for help            ");
     printf("\n\t\t Enter 5 to quit             ");
     printf("\n\t\t****************************************\n\n");
     options=toupper(getch());
     if (options=='2')
	{
	show_record();
	goto mainhome;
	}
     else if (options=='3')
	{
	help();getch();
	goto mainhome;
	}
	else if (options=='4')
	{reset_score();
	getch();
	goto mainhome;}
	else if (options=='5')
	exit(1);
    else if(options=='1')
    {
     system("cls");

  • Create a show record window in Quiz Game Project in C.

In this section, we will learn on how create a show record window. To start with, add the following code in your main.c

void show_record()
    {system("cls");
	char name[20];
	float scr;
	FILE *f;
	f=fopen("score.txt","r");
	fscanf(f,"%s%f",&name,&scr);
	printf("\n\n\t\t*************************************************************");
	printf("\n\n\t\t %s has secured the Highest Score %0.2f",name,scr);
	printf("\n\n\t\t*************************************************************");
	fclose(f);
	getch();}

  • Create a reset score window in Quiz Game Project in C.

In this section, we will learn on how create a reset score window. To start with, add the following code in your main.c

void reset_score()
    {system("cls");
    float sc;
	char nm[20];
	FILE *f;
	f=fopen("score.txt","r+");
	fscanf(f,"%s%f",&nm,&sc);
	sc=0;
	fprintf(f,"%s,%.2f",nm,sc);
    fclose(f);}

Downloadable Source Code

Summary

In summary, this Quiz Game mini project in C with Source Code can be useful to students or professional who wants to learn C Programming Language.

This project can also be modified to fit your personal requirements. Hope this project will help you to improve your skills. Happy Coding!

Inquiries

If you have any questions or suggestions about Quiz Game in C with Source Code, please feel free to leave a comment below.

4 thoughts on “Quiz Game in C with Source Code”

Leave a Comment