Report Full C++
Report Full C++
COMPUTER PROGRAMMING
SECTION : 3
LECTURER : DR MUHAMAD ZAINI BIN YUNOS
PROJECT : GAME
GROUP MEMBERS
1.RONNIE CHAI TECK WEI
2.RAJA MOHD FIKRI BIN
TENGKU BADLI
MATRIC NO.
DD130055
AD130050
CONTENT
Table of Contents
Content.................................................................................................................................2
List of tables and figures......................................................................................................3
1.Introduction.......................................................................................................................4
1.1 About the game,advantages and constraint.............................................................6
2.Objectives..........................................................................................................................
7
3.Methodology......................................................................................................................
3.1 Program Code.........................................................................................................8
3.2 Flow Chart.............................................................................................................11
3.3 Pseudo Code..........................................................................................................16
4.Games Manual....................................................................................................................
4.1 Explanation how to run the games........................................................................18
4.2 Flowchart to play game.........................................................................................20
5.Conclusion......................................................................................................................20
6.References.......................................................................................................................21
Figure 1[1]...........................................................................................................................4
Figure
2[2]..........................................................................................................................18
1. INTRODUCTION
Figure 1[1]
2. OBJECTIVES
In this project, we make a game by writing code in dev c++ software. The objectives of
this project are as follows :
Table 1[1]
NO
1
OBJECTIVES
Learn how to use programming software such as dev c++ 4.9.2 & dev c++
5.9.1(for windows 8)
3
4
From this project we will also learn how to correct the error done during writing
the code.
3.METHODOLOGY
PROGRAM CODE
#include <stdio.h>
#include <conio.h.>
void correct(), wrong();
int point;
main()
{ int i, a[5];
printf("\t\tWelcome to Ron's and Raja's SCRAMBLE GAME");
printf("\n\t\t________________________________________");
printf("\n****************************************************************
***************");
printf("\n\nThis game is to rearrange the randomize alphabet to form a word.. ");
printf("\n\n***************************************************************
****************");
printf("\n\n\tgnireenigne");
printf("\n\n1 - ngeineering\n2 - engineering\n3 - enginerieng\n>>");
scanf("%d", &a[i]);
if(a[i]==1)
wrong();
else if(a[i]==2)
correct();
else if(a[i]==3)
wrong();
}
if(i==2)
{
printf("\n\nPlease rearranged the following alphabet to form a word..");
printf("\n\n\traeg");
printf("\n\n1 - gear\n2 - gaer\n3 - grea\n>>");
scanf("%d", &a[i]);
if(a[i]==1)
correct();
else if(a[i]==2)
wrong();
else if(a[i]==3)
wrong();
}
}
printf("\n\n\nYour final score is %d !!", point);
switch (point)
{
case 3 : printf("\n\nCONGRATULATIONS. You get full mark !!! "); break;
case 2 : printf("\nYou get 2 out of 3 mark. Not bad. Please try again :) "); break;
case 1 : printf("\nYou only get 1 mark. Please try again :) "); break;
}
}
void correct()
{
system("cls");
printf("\n\a\aYou are correct :D\n\n");
printf("\n****************************************************************
10
***************");
point++;
}
void wrong()
{
system("cls");
printf("\n\a\a\aYou are wrong :(\n\n");
printf("\n****************************************************************
***************");
}
11
FLOW CHART
Start
i=0
i=0
i=1
i<3
i ++
Final score
== 1
Final score
== 2
Print CONGRATULATIONS.
You get full mark
Print You
only get 1
mark. Please
try again
Print You
get 2 out of 3
mark. Not
bad. Please
try again
End
12
Scanf a[i]
a [i] == 1
correct ()
a [i] == 2
wrong ()
N
wrong ()
13
Scanf a[i]
a [i] == 1
wrong ()
a [i] == 2
correct ()
N
wrong ()
14
Scanf a[i]
a [i] == 1
a [i] == 2
correct ()
wrong ()
N
wrong ()
15
correct ()
system cls
point ++
wrong ()
system cls
16
PSEUDO CODE
1.
2.
3.
4.
17
18
4. GAMES MANUAL
Figure 2[2]
Start
19
5. CONCLUSION
In conclusion,this project has been done successfully. We have learn how to write code to
produce a game. Although the game that we created is a simple game, however we realize
it is hard even to write a simple game. We went through lots of error before able to
complete it. From that error we know where are our mistake and went through internet
and books to repair the error of the code. Besides that we also learn how to use DevC++
well after this project as because before this we only use this software in the lab. We
apply for, else if, switch and system(cls) in our game code. Although we learn only a
few in the lab, this project enable us to explore more ways to code.
One of the most important thing of this project is we gain teamwork in order to complete
this task. We did this project as partner and the both of us help each other and keep
advising each other to find more information related to this project.
Before ending this report, we would like to thank our computer programming lecturer Dr
Muhammad Zaini Bin Yunos for guiding us to complete this project.
20
6. REFERENCES
[1] C++ Programming An Introduction, Norhashidah Mohd.Ali, Tan Guat Yew, Penerbit
Universiti Sains Malaysia, 2007.
[2] The C++ Programming Language, Special Edition, Bjarne Stroustrup,Addison
Wesley,2000.
[3] C++ Coding Standards, Herb Sutter, Andrei Alexandrescu, Addison-Wesley Pearson
Education.2004.
[4] http://en.wikipedia.org/wiki/Programming_language
[5] http://www.slideshare.net/shammimehra/c-25357907?qid=2f99cd16-9891-4c7abe9d-2b6edc3a14ed&v=qf1&b=&from_search=5
[6] http://www.gametutorials.com/tutorials/cpp-tutorials/