WHO WILL BE THE MILLIONAIRE (Using File Directory)

C Project

Who Will Be The Millionaire

(Using File Directory)

 

Authors:

Nafisa Binta Tofayel (180205)

Jawadul Islam (180213)

Musfiq Rahman (180214)

Jannatul Ferdous (180215)

Mukit Hasan Pranto (180224)

 

Computer Science and Engineering Discipline,

Khulna University.

28 October 2018.

Indroductry

C is an inevitable part of coding. Most of us who wants to learn programming as a beginner, starts by learning C. Mini projects like creating games or applications is always fun and challenging for a beginner programmer who completed learning the core parts of C language. The game “Who Will Be The Millionaire” is inspired by the famous reality show goes with the same name. The source code is not that long, over 400 lines. It is compiled in Code::Blocks IDE with GCC compiler. Various sound effect has been added to this project so in compiler linker settings “winmm” has been added. To help understand the code many comments will be given in the source code.

N.B: This project is created with file directory so other .txt file is as important as the source file.

Click on the link below to directly download the source file along with other important files used in this project.

 

Download Link

Click here to download all the mandatory files needed for this project ->

Download Here

 

 

About This Project

The project on “Who Will Be The Millionaire” is an console application which has no graphics interface. Although various sound effects are used. The unique thing about this game is, it is created mainly by file directory. Total number of 15 questions will be presented in the game and all 15 of them will be randomly selected from 15 files which contains 10 questions each. A total number of 32 .txt files are created. 15 files for questions and 15 files for answer and lastly 2 files for adding and showing records. There are also 3 .wav files created for Intro, right answer and wrong answer background music. The prize pool ladder for 15 questions is as same as the original.

 

 

First of all, to add audio effect “winmm” library need to be added in the compiler linker setting.

https://drive.google.com/file/d/1Y-jdirjYppBNj-e4GbbG9d7BzNTfZxAe/view?usp=sharing

https://drive.google.com/file/d/1dsQrA051uAqgicw_sNaKXKS2Bjk0O7Kt/view?usp=sharing

-+

Gameplay

The game opens in the main menu which has 3 options.

https://drive.google.com/file/d/1g1B0s1beqU2WVaBXJWfoSQRNnlv652Zx/view?usp=sharing

By pressing ‘I’, the introduction window pops up, in which the prize money ladder is explained.

https://drive.google.com/file/d/19fx8yf_awTeGPkFh4VzJdp6nDEPmTB0f/view?usp=sharing

By pressing ‘R’, the previous records for the game shows up.

https://drive.google.com/file/d/1wZU0-MePaFh7V0zt_H-LtyQTkVa9mG0W/view?usp=sharing

By pressing ‘S’, The game of knowledge begins. For every right answer, player will get the rightful amount of prize money and climb up the ladder.

https://drive.google.com/file/d/1_wMdstIwqMRUCDkM-SFkuSZQ5BpR-kBO/view?usp=sharing

But for a wrong answer, the game will be terminated and player will return to the main menu.

https://drive.google.com/file/d/1muORgeRARgA0M0bjavRv1DB1qzAmjWaw/view?usp=sharing

 

 

 

Function Explanation

The functions used in the source code are simple and easy to understand. They are described in the source code with comments.

The following library functions are used:

  1. <stdio.h> – for standard input output
  2. <conio.h> – for console input output
  3. <ctype.h> – for case sensitivity
  4. <time.h> – for generating a random number
  5. <windows.h> – for declaration of all the function especially <MMSystem.h>
  6. <MMSystem.h> – multimedia function for adding multimedia files.

 

The following user defined functions are used:

  1. void open_sector(char question[20], char answer[20]) : This is the most important function. It contains two other functions named as ‘void questions() and ‘void answer_match()’. It opens both the question and answer files in reading mode. After that it calls both the functions.

https://drive.google.com/file/d/1bfZt1LsdD2iY0V8-CcWHDOGxY7Iak2gM/view?usp=sharing

 

  1. void question(): First a random number is generated by using srand(time(0)), rand() and <time.h>. Then it prints a random question with options.

https://drive.google.com/file/d/1yGybPvxAQuF5wcJZaSiVsEUDvhkaNqeq/view?usp=sharing

 

  1. void answer_match(): First an input is taken from the user then it matches with the correct answer. If it doesn’t match the answer then the game will take user to the main menu.

https://drive.google.com/file/d/1W-wbxNXN083NOMPG47uE-K5xg0qtx5cu/view?usp=sharing

 

  1. void add_record(): After every game ends. The name of the player and the prize money is printed in a separated file.

https://drive.google.com/file/d/1Ed9CA6gz6t-knhdObqEFdwHVzP95kIkC/view?usp=sharing

 

  1. void show_record(): It shows the previous records in the console by printing the values from the file.

https://drive.google.com/file/d/15kksc7kcFHJHWkDpnPiFeG92MkiaqDb_/view?usp=sharing

 

Thank you very much.

 

THE END