Hi,
There are a bunch of things I would change:
C++ include files don't have a .h on the end:
1 2 3 4 5 6 7
|
#include<iostream>
#include<conio.h> // avoid using this, it's ancient and non standard
#include<dos.h> // why do you have this ?
#include<stdlib.h>
#include<string>
#include<process.h> // why do you have this ?
#include<ctype>
|
This and similar things elsewhere is plain annoying:
23 24 25 26 27 28 29
|
sleep(1);
cout<<".";
sleep(1);
cout<<".";
sleep(1);
cout<<".";
sleep(1);
|
If you really want to do this, put it in a function. Any time you have repetitive code, there is a better way.
With this:
1 2 3 4
|
struct criminal
{ int rn,id,age,yrs;
char name[25],crime,des[100],dang,gng;
}c[100];
|
Choose better variable names. There is no need to abbreviate the hell out of everything, meaningful names would vastly improve your code. If you do this well, the code should read like a story.
Declare1 variable per line, comment expected range of valid values.
Don'truneverythingtogether - put some spaces around operators.
Don't have global variables. Limit the scope of variables as much as possible, at least declare this variable in
main
:
std::vector<criminal> CriminalData; //use vector rather than array
void main ()
It's always
int main()
, that's mandated in the C++ standard.
Put menu display into their own functions. Declare the functions before
main
, put the definitions of them after
main
.
Line 29: std::cout statements can be built up in stages, no need to have a massive long statement that is 3 screens wide:
1 2
|
std::cout << "\n\n\nWelcome To The F.B.I Criminal Record Page, Information Beyond This Point Is Highly " ;
std::cout << "Confidential, Are You Sure You Want To Continue?"<<"\tEnter Y To Continue ";
|
I am not a fan of
do
loops, just because they always execute once shouldn't be a reason to prefer them. All 3 looping statements can be converted from one to another, so I would have a
while
loop for this. Notice you have the logic to continue is asked twice?
With
switch
statements, consider having each
case
to call a function, this will tidy up your code considerably.
Lines 71 to 86 , you have this twice, so put it in a function.
Good Luck !!