Sie sind auf Seite 1von 70

A COMPUTER PROJECT ON

“computer science”
Compiled by:
Ayushi Agarwal

Introduction
C++ is a computer language but with a difference.
C++ designers have borrowed the best features of many existing
languages as c, c# etc. and added a few new features to form a
simple easy to learn and an object oriented language. C++ adds
a concept called “operator overloading” not seen in the earlier
OOP languages and it makes the creation of libraries much
cleaner

This project is for novice as well as for good


programmers. As the name suggests, the project is all about
data on nuclear physics and related fields. It has been prepared
as an example of C++ programming. It presents a contemporary
approach to the programming of the project with stress on
principles of good programming such as clarity, legibility, and
efficiency in program design. Thus an interactive programming
has emphasized throughout the project.

The project makes an extensive use of file handling.


Basically it consists of only four functions. It provides all required
data on nuclear physics on just a click of the mouse. It also
includes the options for background and font color modifications.
Exclusive use of animations is also done to provide a complete
understanding of the topic. Hope that the project withstands up
to user’s expectations
Aim Of The
Project

The project is basically an encyclopedia on the


topic of “ NUCLEAR PHYSICS”. It aims at providing all required
information about nuclear physics such as its history, present
condition and its future scope on just a click of the mouse. The
project is embedded with the different types of radioactive
decays , nuclear fission, nuclear fusion and their use in the
production of energy and different hazards related to this. The
project exclusively mentions the contributions of different
scientists and researchers in the field of nuclear physics.

Some essential features are……………………

 Detailed information
 Includes animations
 Colorful presentation
 Setup change options
 Easy and convenient to use
 As fast as possible
 User friendly
 Safe for the user
Acknowledgem
ent
It was really a great opportunity for
me to make this project work on the respective topic. I
would like to wholeheartedly thank my respected
computer teacher MrsKESARWANI MAM for providing
me such a great opportunity. I am indebted to MAMwho
took great pains in going through the entire manuscript
and made valuable comments.

I am thankful to my parents for their


humble cooperation, constant support and
encouragement throughout the work of the project. I
am beholden to my classmates who gave me valuable
advice and were good enough to find time for fruitful
discussions.

Finally, I thank the authorities of our


school S.P.S.E.C. for providing great educational
opportunities.
AYUSHI
AGARWAL

______________
_______________
Teacher’s signature
Invigilator’s signature

IT’S HISTORY:

C++ was written by Bjarne Stroustrup


at Bell Labs during 1983-1985. C++ is an extension of “C”. Prior
to 1983, Bjarne Stroustrup added features to “C” and formed
what he called “C with classes”. He had combined the Simula’s
use of classes and added object oriented features with the power
and efficiency of c. The term C++ was first used in 1983.

C++ was developed significantly after its first release. In


particular “ARM C++” added exceptions and templates, and ISO
C++ added RTTI, name spaces and a standard library.
C++ was designed for UNIX operating environment. With
C++ programmers could improve the quality of code they
produced and reusable code was easier to write.

Bjarne Stroustrup had studied in the doctoral program at


the Computing Laboratory at Cambridge University prior to
joining Bell labs. Now, Bell labs no longer have that name since
part of Bell labs became AT&T Labs. The other half became
Lucent Bell labs.

Prior to C++, C was a programming language developed at


Bell Labs circa 1969-1973. the UNIX operating system was also
being developed at Bell Labs at the same time. C was originally
developed for and implemented on the UNIX operating system,
on a PDP-11 computer by Dennis Ritchie.

WORDS ABOUT C++:

C++ is an object oriented programming language created


by Bjarne Stroustrup and released in 1985. It implements data
abstraction using a concept called classes, along with other
features to allow object oriented programming. Parts of the C++
program are easily reusable and extensible; existing code is
easily modifiable without actually having to change the code. C+
+ adds a concept called operator overloading not seen in the
earlier OOP languages and it makes the creation of libraries
much cleaner.

C++ maintains aspects of the aspects of the C


programming language, yet has features which simplify memory
management. Additionally some of the features of C++ allow
low-level access to memory but also contain high level features.

C++ could be considered a superset of C. c programs will


run in C++ compilers. C uses structured programming concepts
and techniques while C++ uses structured object oriented
programming and classes which focus on data. Object oriented
programming (OOP) is programming language model which is
organized around object rather than actions and data rather than
logic. OOP deals with the overall program organization than the
details of program operation. It gives more emphasis on data,
provides extensibility and models of real world problem very well.

A computer is said to be object oriented if it supports four


specific properties called abstraction, polymorphism,
inheritance, and encapsulation.

FEATURES OF C++:

• Character sets:-

Following is the character set of C++:-

Letters: a-z , A-Z


Digits: 0 to 9
Special characters: ~!@#$%^&*()_+|

• Tokens

Smallest unit building block of a program

• Variables
A variable is one which hold certain values. It is a sequence of
alphabets and digits but the first alphabet must be an alphabet
or an underscore.

• Constant

A constant is a value which does not change during program


execution.
They are of four types:
1. Integer 2. Character
3. Floating 4. String

• Data Types

1. Simple/fundamental
2. Pointers
3. Structured/derived
4. Void type
5. Enumerated

1. SIMPLE/FUNDAMENTAL DATA TYPES:

Declaration Type Range Memory size


name in bytes
Integer

Short int Short integer -32768 to 32767 2

Int Integer -32768 to 32767 2

Long int Long integer -214783648 to 4


214783648
Real /floating
point

Float Floating point -3.4E+38 to 4


3.4E+38

Double Double floating -1.7E+308 to 8


point 1.7E+308

Long double Long double -1.7E+308 to 10


floating point 1.7E+308

Character

Char Character -128 to 127 1

Signed char Signed character -128 to 127 1

Unsigned char Unsigned 0 to 255 1


character
Boolean
1
Bool A Boolean value 1
(true / false)

2. STRUCTURED/ DERIVED DATA TYPES:

The data types which are extracted/derived from


fundamental data types are called derived data types. These
data types can be derived by using the declaration operators or
punctuators.
These are:
1. array
2. function
3. structure
4. class
5. pointer
3. ENUMERATED DATA TYPES:

In C++ we can define our own data type and specify what
values a variable of this type can take. The data type defined this
way is known as enumerated data type. enumerated data type
helps in enhancing the readability of the code.

4. POINTER DATA TYPES:

A pointer is a variable which hold the address of another


variable. It is going to hold a pointer. The pointer variable can be
declared with the help of a punctuator `*’.

5. THE VOID DATA TYPE:

The void data type , also known as empty data type, is


useful in many situations. It ia used to specify the return type of
a function that is not supposed to return a value, empty
argument list of a function and to declare generic pointer.

PREPROCESSOR DIRECTIVES:

The first line of any program: #include<iostream.h>


is a preprocessor directives, i.e. a message to the C++
processors. Lines beginning with # are processed by the
preprocessor before the program is compiled. This specific line
tells the preprocessor to include in the program the contents of
the input/output stream header file iostream.h. This file must
be included for any program that outputs data to the screen
input data on the screen.
 COMPILING AND LINKING:

Before the running of a program, there is a phase to


translate the program into machine language. This is done using
C++ compiler. The C++ compiler processes program units that
can be a complete program or just a single function. A C++
compiler has in-built pre-processor. The pre-processor processes
the source code before it is passed to the compiler for
compilation. Pre-processor commands, known as directive, tell
the pre-processor how to process the source code. Depending on
the pre-processor directives, the pre-processor processes the
source code and produces the expanded version of source code.

The C++ compiler takes expanded version of the source


code as its input and if there are no errors in our source code, it
produces a machine code (object code)version of our program.
This process is called as compilation.

There is one additional step our program must go through


after and before running. Thus step is called the linking stage.
When our program is linked, needed runtime information is
supplied to our program. C++ initiates the linking stage
automatically, so we don’t have to worry about the process.
Linking combines the object files into a single executable
program.

OBJECT ORIENTED
PROGRAMMING
Object oriented programming (OOP) is
programming language model which is organized around object
rather than actions and data rather than logic. OOP deals with
the overall program organization than the details of program
operation. It gives more emphasis on data, provides extensibility
and models of real world problem very well. A computer is said
to be object oriented if it supports four specific properties called
abstraction, polymorphism, inheritance, and encapsulation.

DATA ABSTRACTION
As the word indicates abstraction refers to the
representation of only the essential features of the real world
object in the program object. This process does not include the
background details and explanations. This concept of abstraction
is used in classes. A class is thus defined as a list of abstract
attributes and functions which operate on these attributes. This
term abstract data types (ADT) is used to refer classes due to
this reason.

Encapsulation
In object oriented programming , objects interact with
each other by message. The only thing that an object knows
about another is the object’s interface. Each object’s data and
logic is hidden from other’s object. In other words, the interface
encapsulates the object’s code and data.

This allows the developer to separate an object’s implementation


from its behaviour. This separation creates a “black box” affect
where the user is isolated from implementation changes. As long
as interface remains the same, any changes to the
implementation are transparent to the user. For example, if the
name message is sent to the student object , it does not matter
to the user how the developer implemented the code to handle
this message.

All the sending objects needs is the correct protocol for


interacting with the student object. The developer can change
the implementation at any time , but the name message would
still work because the interfaces the same.
 POLYMORPHISM

Another benefit of separating implementation from


behavior is polymorphism. Polymorphism allows two or more
objects respond to the same message. A method called name
could also be implemented for an object of the class courses.

Even though the implementation of this name message may


return a course number and a course title, its protocol is the
same as the name message to the student object. Polymorphism
allows a sending object to communicate with different objects in
a consistent manner without worrying about how many different
implementations of a message.

An analogy of polymorphism to daily life is how students


response to a school bell. Every student knows the significance of
the bell (message) rings however; it has its own meanings to
different students (objects). Some students go home, some go
library and some go to other classes. Every student responds to
the bell, but how they respond to it might be different.

Another example of polymorphism is the function of printing.


Every printable object must know how to print itself. The
message is same to all the different objects: print, but the actual
implementation of what they must do to print themselves varies.
The sending object does not have to know how the receiving
object implements the message. Only the receiving object
worries about that. Assume that there is a print page method in
a document object that has the responsibility of printing a page.
To print the page, the print page method sends the print
message to each object on the page, only that each object
supports the behavior of printing. New objects can be added to
the page without affecting the print page method. This method
still sends the print message and the new object provides its own
print method in response to that message.

Polymorphism allows the sending object to communicate with


receiving object without having to understand what type of
object it is, as long as the receiving object supports the
messages.

INHERITANCE

Another important concept of object oriented


programming is inheritance. Inheritance allows a class to have
the same behavior as another class and exert or tailor that
behavior to provide special action for specific needs.

Let’s use the following application as an example. Both graduate


class and undergraduate class have similar behavior such as
managing a name, major, address and a GPA. Rather than
putting this behavior in both of these classes, the behavior is
placed in a new class called student. Both graduate and
undergraduate become subclass of the class student and both
inherit the student behavior.

Classes that inherit from a class are class subclasses. The classes
that inherit from a class are called superclasses. In the example
student is a superclass for graduate and undergraduate.
Graduate and undergraduate are subclasses of student.
Subclasses provide specialized behaviors from the basis of the
common elements provided by the superclass. Programmers can
implement superclasses called abstract classes that define
common behaviors.
OBJECT ORIENTED
PROGRAMMING vs.
PROCEDURAL PROGRAMMING

OBJECT ORIENTED OBJECT ORIENTED


PROGRAMMING PROGRAMMING

1. Emphasis on data. 1. Emphasis on doing


things(functions).
2. Follows button-up 2. Follows top-down approach
approach in program program design.
design.
3. Presence of global variable
3. Data hiding feature increases chances of
prevents accidental change change data.
in data.
4. Such features are not
4. Features like present in this
encapsulation, programming.
polymorphism, and
inheritance are present.

Thus overall object oriented programming (OOP) leads


procedural programming in many aspects and is better of the
two.
LAYOUT.CPP

#include<iostream.h>
#include<ctype.h>
#include<conio.h>
#include<process.h>
#include<dos.h>
#include<graphics.h>
#include<fstream.h>
#include<stdlib.h>
#include<MPOINT.CPP>
int button,m,n;
int x3[10], y3[10], rad[10], col[10],x1[10],y1[10],
x2[10], y2[10];
class LAYOUT{
MPOINT mptr;
public:
LAYOUT(){
int gd=DETECT,gm;
initgraph(&gd,&gm,"");
counter=1;
int x,y;
x=getmaxx();
y=getmaxy();
mptr.restrictmouseptr(1,1,x-1,y-1);
mptr.showmouseptr();
}
int counter;
void start_it();
void end_it();
public:
void showButtons(){
button_3d(15,425,65,450,0,"MORE",1);
button_3d(222,456,385,475,0,"MAIN MENU",1);
button_3d(530,425,580,450,0,"EXIT",1);
}
void button_3d(int x1,int y1,int x2,int y2,int check,char* text,int
color)
{
int up,low;
setfillstyle(1,7);
bar(x1,y1,x2,y2);
if(check==0)
up=15,low=8;
else
up=8,low=15;
setcolor(low);
line(x2,y1,x2,y2);
line(x2-1,y1,x2-1,y2);
line(x1,y2,x2,y2);
line(x1+1,y2-1,x2,y2-1);

setcolor(up);
line(x1,y1,x2,y1);
line(x1+1,y1+1,x2-1,y1+1);
line(x1,y1,x1,y2);
line(x1+1,y1+1,x1+1,y2-1);
setcolor(color);

settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(x1+(x2 - x1)/2,(y1+(y2 - y1)/2)-2, text);
}
};
void LAYOUT::end_it()
{settextstyle(7,0,3);
if((button&1) && (n>=530 && n<=580) && (m>=425 &&
m<=450))
{
setbkcolor(RED); cleardevice();
while(!kbhit())
{
for(int r=0;r<10;r++)
{
x3[r]=random(640);
y3[r]=random(480);
rad[r]=random(50);
col[r]=random(15);
x1[r]=random(640);
y1[r]=random(480);
x2[r]=random(640);
y2[r]=random(480);
}
for(r=0;r<10;r++)
{
setcolor(col[r]);
outtextxy(x3[r],y3[r],"PHYSICS");
outtextxy(x1[r],y1[r],"NUCLEAR");
}
setcolor(RED);
delay(100);
for(r=0;r<10;r++)
{
outtextxy(x3[r],y3[r],"PHYSICS");
outtextxy(x1[r],y1[r],"NUCLEAR");
}
}

void LAYOUT::start_it()
{ setbkcolor(6);
int x,y,h;
for(int lp=1;lp<8;lp++)
{ if(lp==6)lp=7;
for(x=0;x<=100;x++)
{
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(2);
settextstyle(1,0,4);
setusercharsize(x,6,x,3);
setcolor(14);
moveto(300,100);
outtext("__");
setcolor(6);
moveto(300,100);
outtext("< >");

if(x<90)
{// sound(frec+=10);
delay(lp);}
else
{// sound(frec+=10);
delay(1+lp);
}
}
nosound();
for(y=0;y<=100;y++)
{
setcolor(lp);
settextstyle(1,0,4);
setusercharsize(y,6,y,3);
moveto(300,100);
outtext("__");
moveto(300,100);
outtext("< >");
}
}
for(x=0;x<=100;x++)
{
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(9);
settextstyle(1,0,4);
setusercharsize(x,6,x,3);
setcolor(8);
moveto(300,100);
outtext("__");
setcolor(9);
moveto(300,100);
outtext("< >");
if(x<90)
{// sound(frec+=10);
delay(20);}
else
{// sound(frec+=10);
delay(20);
}
}
nosound();
for(y=0;y<=100;y++)
{
setcolor(0);
settextstyle(1,0,4);
setusercharsize(y,6,y,3);
moveto(300,100);
outtext("__");
moveto(300,100);
outtext("< >");
if(y>20)
{
settextstyle(7,0,1);
setusercharsize(y-20,45,y-20,40);
setcolor(10);
outtext("NUCLEAR PHYSICS");
setcolor(2);
outtext("___________");
delay(10);
if(y<100)
{
settextstyle(7,0,1);
setusercharsize(y-20,45,y-20,40);
setcolor(0);
outtext("NUCLEAR PHYSICS");
}
}
}
//delay(1000);
settextstyle(3,0,2);
delay(50);
setcolor(9);
outtextxy(150,300,"CREATED BY:-");
//x=10,y=10;
setcolor(WHITE);
settextstyle(1,0,4);
outtextxy(335,375,"PRANJAL AND OAJASAVEE");

for (int stangle=0;!kbhit();stangle++)


{
setcolor(7);
ellipse(320,320,stangle,stangle+20,300,130);
ellipse(320,320,stangle+180,stangle+200,300,130);
delay(9);
setcolor(RED);
ellipse(320,320,stangle-1,stangle+19,300,130);
ellipse(320,320,stangle-
1+180,stangle+199,300,130);
setcolor(7);
ellipse(320,320,stangle,stangle+20,302,132);
ellipse(320,320,stangle+180,stangle+200,302,132);
delay(9);
setcolor(8);
ellipse(320,320,stangle-1,stangle+19,302,132);
ellipse(320,320,stangle-
1+180,stangle+199,302,132);
}
getch();
//closegraph();
}

MPOINT.CPP

#include<iostream.h>
#include<ctype.h>
#include<conio.h>
#include<process.h>
#include<dos.h>
#include<graphics.h>
#include<fstream.h>
#include<stdlib.h>
class MPOINT
{
public:
int button,m,n;
union REGS i,o,a,b;
int intmouse()
{
i.x.ax=0;
int86(0x33,&i,&o);
return(o.x.ax);
}
void showmouseptr()
{
i.x.ax=1;
int86(0x33,&i,&o);
}
void restrictmouseptr(int x,int y,int x1,int y1)
{
i.x.ax=7;
i.x.cx=x;
i.x.dx=x1;
int86(0x33,&i,&o);
i.x.ax=8;
i.x.cx=y;
i.x.dx=y1;
int86(0x33,&i,&o);
}
void getmousepos(int *p,int *x,int *y)
{
i.x.ax=3;

int86(0x33,&i,&o);
*p=o.x.bx;
*x=o.x.cx;
*y=o.x.dx;

}
};
/*void main(){
int button,m,n;
MPONIT x;
int gd=DETECT,gm;
initgraph(&gd,&gm,"\\tc\\bgi");
x.getmousepos(&button,&m,&n);
x.showmouseptr();

cout<<m;
getch();

} */

SETUP.CPP

#include<iostream.h>
#include<ctype.h>
#include<conio.h>
#include<process.h>
#include<dos.h>
#include<graphics.h>
#include<fstream.h>
#include<stdlib.h>

int ctmbgcolor;
int ctmfntcolor;

//1:BG
//2:FONT
int clrType;

void setDefaultBG(){
ctmbgcolor=6;
}
void setBGColor(int clr){
ctmbgcolor =clr;
}
int getBGColor(){
return ctmbgcolor;
}
int getFontcolor(){
return ctmfntcolor;
}
void setFontcolor(int clr){
ctmfntcolor=clr;
}
void setDefaultFontClr(){
ctmfntcolor=15;
}

int button_s,m_s,n_s;
union REGS i,o,a,b;
int intmouse()
{
i.x.ax=0;
int86(0x33,&i,&o);
return(o.x.ax);
}
void showmouseptr()
{
i.x.ax=1;
int86(0x33,&i,&o);
}
void restrictmouseptr(int x,int y,int x1,int y1)
{
i.x.ax=7;
i.x.cx=x;
i.x.dx=x1;
int86(0x33,&i,&o);
i.x.ax=8;
i.x.cx=y;
i.x.dx=y1;
int86(0x33,&i,&o);
}
void getmousepos(int *p,int *x,int *y)
{
i.x.ax=3;
int86(0x33,&i,&o);
*p=o.x.bx;
*x=o.x.cx;
*y=o.x.dx;

void button_3d(int x1,int y1,int x2,int y2,int check,char* text,int


color,int fill)
{
int up,low;
if(fill==1)
{
setfillstyle(1,color);
}
else{
setfillstyle(1,7);
}
bar(x1,y1,x2,y2);
if(check==0)
up=15,low=8;
else
up=8,low=15;
setcolor(low);
line(x2,y1,x2,y2);
line(x2-1,y1,x2-1,y2);
line(x1,y2,x2,y2);
line(x1+1,y2-1,x2,y2-1);

setcolor(up);
line(x1,y1,x2,y1);
line(x1+1,y1+1,x2-1,y1+1);
line(x1,y1,x1,y2);
line(x1+1,y1+1,x1+1,y2-1);
setcolor(color);

settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(x1+(x2 - x1)/2,(y1+(y2 - y1)/2)-2, text);
}
void repaintButton(int i);
void paintButtons(int chkNum){
int x1,y1,x2,y2,chk;
chk=0;
for (int i=1;i<17;i++)
{
if(i<=4)
{
x1=20+100*i;
x2=110+100*i;
y1=10;
y2=110;
}
if(i>4&&i<=8)
{
x1=20+100*(i-4);
x2=110+100*(i-4);
y1=120;
y2=220;
}
if(i>8&&i<=12)
{
x1=20+100*(i-8);
x2=110+100*(i-8);
y1=230;
y2=330;
}
if(i>12)
{
x1=20+100*(i-12);
x2=110+100*(i-12);
y1=340;
y2=440;
}
if(chkNum==i)
{
chk=1;
}
else{
chk=0;
}
button_3d(x1,y1,x2,y2,chk,"A",i-1,1);
}
button_3d(250,450,350,470,0,"Done",9,0);
}

void pickColor(){
//setDefaultBG();
//setDefaultFontClr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"");

clrType=3;
int button,m,n,num_button;
settextstyle(7,0,3);
button_3d(40,86,581,110,0, " Change Background Color ",1,0)
;
button_3d(40,124,581,148,0," Change Font Color ",1,0) ;
button_3d(40,162,581,186,0," Back ",1,0) ;

getmousepos(&button,&n,&m);
gotoxy(1,1);

int z,zz;
z=1;
zz=1;
int x,y;
x=getmaxx();
y=getmaxy();
restrictmouseptr(1,1,x-1,y-1);
showmouseptr();
setbkcolor(0);
settextstyle(15,0,1);
outtextxy(20,30,"Select BG");
int d;
while(z){
//cleardevice();
getmousepos(&button,&n,&m);
if((button&1) && (n>=40 && n<=581) && (m>=86 &&
m<=110))
{
//BG
clrType=1;
}
if((button&1) && (n>=40 && n<=581) && (m>=124 &&
m<=148))
{
//FC
clrType=2;
}
if((button&1) && (n>=40 && n<=581) && (m>=162 &&
m<=186))
{
setDefaultBG();
setDefaultFontClr();
z=0;
}
if(clrType==1||clrType==2)
{
cleardevice();
paintButtons(20);
while(zz){
getmousepos(&button,&n,&m);
gotoxy(1,1);

if(button&1){
if(m<441&&m>330)
{
d=n/100;
num_button=d+12;
}
if(m<331&&m>220)
{
d=n/100;
num_button=d+8;

}
if(m<221&&m>110)
{
d=n/100;
num_button=d+4;

}
if(m<111&&m>10)
{
d=n/100;
num_button=d;
}
//cout<<"clrType"<<clrType;

paintButtons(num_button);
if(clrType==1)
{
setBGColor(num_button-1);
}
if(clrType==2)
{
setFontcolor(num_button-1);
}

if((button&1) && (m>=450 && m<=470) && (n>=250 &&


n<=350)){
zz=0;
z=0;
}
}

}
}
}
/*void main(){
pickColor();
} */

MAIN.CPP

#include<iostream.h>
#include<ctype.h>
#include<conio.h>
#include<process.h>
#include<dos.h>
#include<graphics.h>
#include<fstream.h>
#include<stdlib.h>
#include<LAYOUT.CPP>
#include<SETUP.CPP>
int z;
int bgclr;
int fntclr;
class MAIN:LAYOUT{
MPOINT mptr;
public:
int showText(char * file,char *header,int type);
public:
void showMenu();
public:
void strucAni();
void fusionAni();
void fusionEq();
void fissionAni();
void decay();
public:
void init(){
bgclr=6;
fntclr=15;
start_it();
showMenu();
}
};
int MAIN::showText(char *file,char *header,int type){
{
char ch[100];
ifstream jk;
int button,m,n;
cleardevice();
setcolor(14);
settextstyle(5,0,3);
outtextxy(320,5,header);
jk.open(file,ios::in);
settextstyle(6,0,1);
counter=1;
next:
settextstyle(6,0,1);
//button_3d(15,425,65,450,0,"MORE",1);
//button_3d(530,425,580,450,0,"EXIT",1);
//button_3d(222,456,385,470,0,"MAIN MENU",1);
showButtons();
setcolor(fntclr);
int axis=90;
for(int count=1;count<20;count++)
{
if(jk.getline(ch,80) )
outtextxy(325,axis,ch);
axis+=15;
}
counter++;
cout<<"clicks "<<counter<<endl;
if(type==1)
{
if(counter==16)
{
strucAni();
}
if(counter>18)
{
counter=0;
showMenu();
}
}
if(type==5)
{
if(counter==50)
{
fusionAni();
}
if(counter==51)
{
fusionEq();
}
if(counter==60)
{
showMenu();
}
}
if(type==4)
{
if(counter==2){
fissionAni();
}
if(counter==3)
{
showMenu();
}
}

setcolor(15);
z=1;
while(z)
{
mptr.getmousepos(&button,&n,&m);
gotoxy(1,1);
cout<<"n ="<<n<<" m = "<<m<<" ";
if((button&1) && (n>=15 && n<=65) && (m>=425 &&
m<=450))
{cleardevice();
goto next; }

if((button&1) && (n>=222 && n<=385) && (m>=456 &&


m<=475))
{cleardevice();
jk.close();
showMenu();
}
if((button&1) && (n>=530 && n<=580) && (m>=425 &&
m<=450))
{ end_it();
exit(0);
button=0;
z=0;
}
}
}
return counter;
}
void MAIN::showMenu()
{
MPOINT mptr;
int clicks;
cleardevice();
setbkcolor(bgclr);
setcolor(5);
button_3d(28,70,600,410,0,"",1);
// setlinestyle(1,1,1);
settextstyle(3,0,5);
for(int werx=1;werx<6;werx++)
{
setusercharsize(werx,2,werx,3);
outtextxy(300,35,"MAIN MENU");
delay(50);
}
setcolor(0);
for(int wex=1;wex<5;wex++)
{
setusercharsize(wex,2,wex,3);
outtextxy(300,35,"MAIN MENU");
delay(50);
}
setcolor(1);
setusercharsize(5,2,5,3);
outtextxy(300,35,"MAIN MENU");
settextstyle(7,0,3);
delay(25); button_3d(40,86,581,110,0, "CHAPTER 1:
STRUCTURE OF AN ATOM",0) ;
delay(25); button_3d(40,124,581,148,0,"CHAPTER 2: THE
NUCLEUS ",1) ;
delay(25); button_3d(40,162,581,186,0,"CHAPTER 3: TYPES OF
DECAYS ",2) ;
delay(25); button_3d(40,200,581,224,0,"CHAPTER 4: NUCLEAR
FISSION ",3) ;
delay(25); button_3d(40,238,581,262,0,"CHAPTER 5: NUCLEAR
FUSION ",4) ;
delay(25); button_3d(40,276,581,300,0,"CHAPTER 6: GREAT
DISCOVERIES ",5) ;
delay(25); button_3d(40,314,581,338,0,"CHAPTER 7: NUCLEAR
PLANTS ",6) ;
delay(25); button_3d(40,352,581,376,0,"CHAPTER 8: DETAILED
TOPICS ",8) ;
settextstyle(3,0,3);
button_3d(530,425,580,450,0,"EXIT",1);
button_3d(20,425,90,450,0,"SETUP",1);
settextstyle(7,0,3);
z=1;
//setcolor(fntclr);

while(z)
{
mptr.getmousepos(&button,&n,&m);
gotoxy(1,1);

if((button&1) && (n>=40 && n<=581) && (m>=86 &&


m<=110))
{
//structure();
showText("atom.txt","Structure of atom",1);
}

if((button&1) && (n>=40 && n<=581) && (m>=124 &&


m<=148))
{
//nucleus();
showText("nucleus.txt","The Nucleus",2);
}
if((button&1) && (n>=40 && n<=581) && (m>=162 &&
m<=186))
{
decay();
int done;
done=1;
while(done)
{
getmousepos(&button,&n,&m);
gotoxy(1,1);
cout<<"n ="<<n<<" m = "<<m<<" ";
// button_3d(15,425,65,450,0,"MORE",1);
if((button&1) && (n>=15 && n<=65) && (m>=425 &&
m<=450))
{//cleardevice();
// goto next2;
}
if((button&1) && (n>=222 && n<=385) && (m>=456 &&
m<=470))
{cleardevice();
// jk1.close();
showMenu(); }
// button_3d(15,425,65,450,0,"MORE",1);
if((button&1) && (n>=113 && n<=237) && (m>=53 &&
m<=113))
{
showText("beta.txt","Beta Decay",77);
}

if((button&1) && (n>=344 && n<=494) && (m>=111 &&


m<=132))
{
showText("alpha.txt","Alpha Decay",77);
}

if((button&1) && (n>=77 && n<=243) && (m>=362 &&


m<=379))
{
showText("positron.txt","Positron Emission",77);
}

if((button&1) && (n>=346 && n<=511) && (m>=362 &&


m<=375))
{
showText("gamma.txt","Gamma Decay",77);

// button_3d(530,425,580,450,0,"EXIT",1);

if((button&1) && (n>=530 && n<=580) && (m>=425 &&


m<=450))
{end_it();
exit(0);
button=0;
done=0;
}
}

//showText("","",3);
}

if((button&1) && (n>=40 && n<=581) && (m>=200 &&


m<=224))
{
//fission();
showText("fission.txt","Nuclear Fission",4);
}
if((button&1) && (n>=40 && n<=581) && (m>=238 &&
m<=262))
{
//fusion();

showText("fusion.txt","Nuclear Fusion",5);
}

// (40,314,581,338,
if((button&1) && (n>=40 && n<=581) && (m>=314 &&
m<=338))
{
//plants();
showText("plants.txt","Nuclear Plants",6);
}
// button_3d(40,276,581,300,0,"CHAPTER 6: GREAT
DISCOVERIES ",5) ;
if((button&1) && (n>=40 && n<=581) && (m>=276 &&
m<=300))
{
// discovery();
showText("disco.txt","Great Discoveries",7);
}

if((button&1) && (n>=40 && n<=581) && (m>=352 &&


m<=376))
{ cleardevice();
delay(25); button_3d(40,86,581,110,0, "SECTION 8A:
RADIOACTIVITY ",0) ;
delay(25); button_3d(40,124,581,148,0,"SECTION 8B:
NUCLEAR ENERGY ",1) ;
delay(25); button_3d(40,162,581,186,0,"SECTION 8C:
NUCLEAR FUEL CYCLE ",2) ;
delay(25); button_3d(40,200,581,224,0,"SECTION 8D:
NUCLEAR RESEARCH ",3) ;
delay(25); button_3d(40,238,581,262,0,"SECTION 8E:
QUANTUM ATOM ",4) ;
delay(25); button_3d(40,276,581,300,0,"SECTION 8F: DUAL
NATURE ",5) ;
delay(25); button_3d(40,314,581,338,0,"SECTION 8G:
ELEMENTRY PARTICLES ",6) ;

settextstyle(3,0,3);
button_3d(530,425,580,450,0,"EXIT",1);
button_3d(222,456,385,475,0,"MAIN MENU",1);
int fw=1;
while(fw)
{
mptr.getmousepos(&button,&n,&m);
gotoxy(1,1);
//cout<<"n ="<<n<<" m = "<<m<<" ";
if((button&1) && (n>=530 && n<=580) && (m>=425 &&
m<=450))
{ end_it();
exit(0);
button=0;
z=0;
}

if((button&1) && (n>=222 && n<=385) && (m>=456 &&


m<=475))
{cleardevice();
// jk1.close();
showMenu(); }
if((button&1) && (n>=40 && n<=581) && (m>=86 &&
m<=110))
{
//radio();
showText("radio.txt","Radioactivity",8);
}
//button_3d(40,276,581,300,0,"SECTION 8F: DUAL NATURE
",
if((button&1) && (n>=40 && n<=581) && (m>=276 &&
m<=300))
{
//dual();
showText("dual.txt","Dual Nature",9);

}
// (40,200,581,224,0,"SECTION 8D: NUCLEAR RESEARCH
",3)
if((button&1) && (n>=40 && n<=581) && (m>=200 &&
m<=224))
{
//research();
showText("research.txt","Nuclear Research",10);
}
if((button&1) && (n>=40 && n<=581) && (m>=124 &&
m<=148))
{
//energy();
showText("energy.txt","Nuclear Energy",11);
}

if((button&1) && (n>=40 && n<=581) && (m>=162 &&


m<=186))
{
//fuel();
showText("fuel.txt","Nuclear Fuel Cycle",12);
}
//delay(25); button_3d(40,200,581,224,0,"SECTION 8D:
NUCLEAR RESEARCH ",3) ;
if((button&1) && (n>=40 && n<=581) && (m>=238 &&
m<=268))
{
//quantum();
showText("quantum.txt","Quantum Atom",13);
}

// delay(25); button_3d(40,276,581,300,0,"SECTION 8F: DUAL


NATURE ",5) ;
if((button&1) && (n>=40 && n<=581) && (m>=314 &&
m<=338))
{
//particle();
showText("particle.txt","Elementry particle",14);
}
}
}

if((button&1) && (n>=530 && n<=580) && (m>=425 &&


m<=450))
{
end_it();
exit(0);
button=0;
z=0;
}
if((button&1) && (n>=20 && n<=70) && (m>=425 &&
m<=450))
{ pickColor();
bgclr=getBGColor();
fntclr=getFontcolor();
if(bgclr==fntclr){
cleardevice();
bgclr=6;
fntclr=15;
setcolor(15);
// cout<<"same color ";
outtextxy(250,100," same BG and Font color" );
outtextxy(250,130, "reseting colors");
outtextxy(250,160, " press any key to cont..");
getch();
}

cleardevice();
//bgclr=clr;
showMenu();
}
}
}
void MAIN::strucAni(){
settextstyle(5,0,3);
//outtextxy(6,434,"structure of an atom");
settextstyle(15,0,1);
delay(500);circle(318,239,50);
delay(500);outtextxy(320,215,"NUCLEUS");
delay(500);outtextxy(315,241,"protons");
delay(500);outtextxy(315,260,"neutrons");
delay(1000);
circle(318,239,120);
delay(500);circle(318,239,150);
delay(500);circle(318,239,180);
delay(500);circle(318,239,210);
delay(200);outtextxy(443,235,"K");
delay(200);outtextxy(473,235,"L");
delay(200);outtextxy(503,235,"M");
delay(200);outtextxy(533,235,"N");
delay(1000);circle(318,119,5);
delay(100);circle(318,89,5);
delay(100);circle(318,59,5);
delay(100);circle(318,29,5);
delay(100);circle(318,358,5);
delay(100);circle(318,388,5);
delay(100);circle(318,418,5);
delay(100);circle(318,448,5);

delay(100);circle(168,235,5);
delay(100);circle(138,235,5);
delay(100);circle(108,235,5);
delay(100);circle(214,133,5);
delay(100);circle(191,111,5);
delay(100);circle(174,87,5);
delay(100);circle(208,338,5);
delay(100);circle(189,363,5);

delay(100);circle(168,384,5);
delay(100);circle(425,133,5);
delay(100);circle(449,113,5);
delay(100); circle(470,95,5);
delay(100); circle(428,342,5);
delay(100); circle(446,365,5);
delay(100); circle(466,389,5);
delay(1000);line(169,86,15,88);
delay(200);line(105,231,15,88);
delay(200);outtextxy(50,76,"electrons");
delay(1000);line(483,166,557,76);
delay(200);line(439,151,557,76);
delay(200);outtextxy(558,62,"orbits");

void MAIN::decay()
{ cleardevice();
circle(290,235,10);
circle(290,255,10);
circle(290,215,10);
circle(290,275,10);
circle(310,215,10);
circle(310,235,10);
circle(310,255,10);
circle(310,275,10);
circle(270,215,10);
circle(270,235,10);
circle(270,255,10);
circle(270,275,10);
circle(330,215,10);
circle(330,235,10);
circle(330,255,10);
circle(330,275,10);
circle(299,244,53);

line(337,208,423,132);
line(261,207,171,127) ;
line(263,283,165,362) ;
line(337,282,432,359) ;
settextstyle(5,0,3);
setcolor(7);
outtextxy(423,115,"alpha emission");
outtextxy(176,98,"beta emission");
outtextxy(165,362,"positron emission");
outtextxy(432,359,"gamma emission");
setcolor(5);
settextstyle(8,0,2);
outtextxy(300,29,"TYPES OF EMISSIONS");
setcolor(15);

settextstyle(6,0,1);
button_3d(15,425,65,450,0,"MORE",1);
button_3d(530,425,580,450,0,"EXIT",1);
button_3d(222,456,385,470,0,"MAIN MENU",1);

}
void MAIN::fusionAni(){
cleardevice();
settextstyle(1,0,1) ;
int j=467;
for(int i=123;i<=295;i++)
{setcolor(0);

circle(i-1,123,20);
circle(j+1,123,20);
setcolor(15);
circle(i,123,20);
circle(j,123,20);
j--;
delay(10);}
setcolor(0);
circle(295,123,20);

setcolor(15);

circle(295,123,40);

settextstyle(5,0,3);
delay(500); outtextxy(298,202,"NUCLEUR FUSION");
delay(500); outtextxy(235,283,"Here 2 hydrogen nucleus
collide to form a helium nucleus");
outtextxy(235,330,"Huge amount of energy is also
produced");
outtextxy(235,377,"These types of reactions take place in
stars");

settextstyle(6,0,1);
button_3d(15,425,65,450,0,"MORE",1);
button_3d(530,425,580,450,0,"EXIT",1);
button_3d(222,456,385,470,0,"MAIN MENU",1);
}

void MAIN::fusionEq(){
settextstyle(3,0,2);settextjustify(0,0);
outtextxy(100,130," 1H1 + 1H1 --> 2H1 + e+ + v +
0.42MeV");
outtextxy(100,150," 2H1 + 2H1 --> 3He2 + n + 3.27MeV");
outtextxy(100,170," 2H1 + 2H1 --> 3H1 + 1H1 + 4.03MeV");
getch();
}
void MAIN::fissionAni(){
cleardevice();
int t=108, u=1;
circle(300,195,60);
for(; u<=151&&t<=259;t++,u++)
{
setcolor(15);
circle(t,u,5);

setcolor(0);
circle(t-1,u-1,5);
delay(25);
}
setcolor(0);
circle(300,195,60);
setcolor(0);
circle(t-1,u-1,5);
setcolor(15);
delay(50);
circle(238,195,20);
circle(359,195,20);

int j=238;
for(int i=359;i<=450;i++)
{setcolor(0);

circle(i-1,195,20);
circle(j+1,195,20);
setcolor(15);
circle(i,195,20);
circle(j,195,20);
j--;
delay(10);}
settextstyle(5,0,3);
outtextxy(306,247,"NUCLEAR FISSION");
outtextxy(306,320,"A neutron strickes an uranium nucleus and
fission takes place");
outtextxy(306,345,"Then uranium nucleus converts into Xenon
and Strontium");
outtextxy(306,370,"Here also huge amount of energy is
produced");
settextstyle(6,0,1);
button_3d(15,425,65,450,0,"MORE",1);
button_3d(530,425,580,450,0,"EXIT",1);
button_3d(222,456,385,470,0,"MAIN MENU",1);
}
void main()
{
MAIN m;
m.init();
}
$ WELCOME ANIMATIONS $
$ WELCOME SCREEN $
$ MAIN MENU $
$ DATA ON STRUTURE OF ATOM $
$ SCHEMATIC DIAGRAM SHOWING $
STRUCTURE OF DIAGRAM
$ DATA ON “ THE NUCLEUS” $
$ ANIMATION SHOWING NUCLEAR FISSION $
$ DATA AND ANIMATION ON “ NUCLEAR FUSION” $

$ DATA ON CONTRIBUTIONS MADE BY SCIENTISTS IN THE


$ FIELD OF NUCLEAR PHYSICS
$ DATA ON “NUCLEAR PLANTS” AND THEIR DEVELOPMENT
$

$ OUTPUT SCREEN DEPECTING DATA ON $


“RADIOACTIVITY”
OUTPUT SCREENS SHOWING DATA ON DIFFERENT KINDS
OF NUCLEAR FORCES

(Note the tabs on the output screens having options for getting
more data, returning to main menu and for exit.)
$ MORE DATA ON NUCLEAR ENERGY AND FORCES $
$ OUTPUT SCREEN DISPLAYING DATA ON $
“NUCLEAR FUEL CYCLE”
AND
“RADIOACTIVE HAZARDS”
OUTPUT SCREEN DISPLAYING DATA ON
“NUCLEAR RESEARCH”

NOTE:- The user could approach more info on nuclear research


by clicking on the “more” tab on the left-bottom of the screen.
OUTPUT SCREEN DISPLAYING DATA ON
“QUANTUM ATOM”

NOTE:- The user could approach more info on “QUANTUM ATOM”


by clicking on the “more” tab on the left-bottom of the screen.
$ DISPLAY OF INTRODUCTION TO ELEMENTARY
PARTICLES $ AND CONSTIUENTS OF UNIVERSE
CONINUED…….
$ THIS OUTPUT SCREEN SHOWS OPTIONS FOR CHANGING
$ BACKGROUND AND FONT COLOR

NOTE:- The user could access these options buy just clicking on
the respective tab. Different color tabs are displayed on the
screen (showed on the next page). After alterations are made,
click on the
“ BACK” tab to return to the main menu.

$ COLOR TABS $

NOTE:- Choose the required background or font color by clicking


on the color tab and click on the “ DONE TAB”.
$ ANIMATED EXIT SCREEN $
I. ACKNOWLEDGEMENT

II. INTRODUCTION

III. AIM OF THE PROJECT

IV. ABOUT C++

 ITS HISTORY
 WORDS ABOUT C++
 FEATURES OF C++
 PREPROCESSOR DIRECTIVES
 COMPILING AND LINKING

V. OBJECT ORIENTED PROGRAMMING

 DATA ABSTRACTION
 ENCAPSULATION
 POLYMORPHISM
 INHERITANCE

VI. OOP VERSUS PROCEDURAL


PROGRAMMING
VII. SOURCE CODE

VIII. OUTPUT SCREENS

IX. BIBLIOGRAPHY

BIBLIOGRAPHY

NO PROJECT CAN BE MADE HIGHLY SUCCESSFUL BY ONLY ONE


PERSON’S THOUGHTS. SUCCESS OF A PROJECT CAN BE
ACHIEVED BY COLLECTING INFORMATION FROM VARIOUS
SOURCES. THE SOURCES CAN BE NUMEROUS LIKE FRIENDS,
COURSE BOOKS, MAGAZINES, AND UNFORGETTABLE VAST
INTERNET. THIS PROJECT ALSO FALLS IN THAT CATEGORY.

SOURCES USED FOR THIS PROJECT ARE:

 GOOGLE SEARCH
 YAHOO SEARCH
 ETC

Das könnte Ihnen auch gefallen