can somebody help me?Im a 1st yr. college student taking up IT. And we have this case study that I cant seem to answer on my own so I decided to join daniweb. The program that Im referring to is a slum book simulating program.
Where you need to enter first a certain username and password before you can enter the whole of the program.
And you also need to integrate a menu that serves as the selection of the user on what task he wants to do. The menu must contain: ADD-To add data into the slumbook, DELETE-To delete the data that you have inputted. EDIT-To edit the data that has been inputted, SEARCH-To search a certain data entered into the program. LIST-the program will list all the data you have inputted. and EXIT to exit the program.
Here is the sample program that I have made, but still it has many errors when you try to run the program:

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main(){
clrscr();
char name[15][20],neym[15][20],ad[15][30],adr[15][20];
char hobiz[15][15],hobez[15][20],dis[15][30],ayaw[15][20];
char aget[15][4],age[15][4],usrnem[4],pasw[4];
char wern,nrew;
int choiz;index://index-keeps track of insertion;
int index=0;
do{
do{
cout<<"This is a slumbook simulating program";
cout<<"\nInput username to enter the program:";
cout<<"\nUsername:";cin>>usrnem;
cout<<"\nInput password:";cin>>pasw;
strcpy(usrnem, "wern");
strcpy(pasw,"nrew");
strcmp(usrnem,usrnem);
strcmp(pasw,pasw);{

}while(pasw=="nrew");
cout<<"\nWelcome";
cout<<"\nMenu:";
cout<<"\n1.ADD DATA:";
cout<<"\n2.EDit DATA:";
cout<<"\n3.DELETE DATA:";
cout<<"\n4.LIST DATA:";
cout<<"\n5.SEARCH DATA:";
cout<<"\nEXIT THE PROGRAM:";
cout<<"\ninput your choice:";cin>>choiz;
if(choiz==1){cout<<"\nThis Function lets you add data into the slumbook:";

cout<<"\ninserting at index"<<index;
cout<<"\nInput name:";gets(name[index]);
cout<<"\nInput address:";gets(adr[index]);
cout<<"\nInput hobbies:";gets(hobez[index]);
cout<<"\nInput dislikes:";gets(ayaw[index]);
cout<<"\nInput age:";cin>>age[index];index++;
	     }

}while(choiz!=6);
if(choiz==2){cout<<"\nThis Function lets you Edit Data in this slumbook:";     }

cout<<"\nInput hte name of the data to be eddited:";gets(name[index]);cout<<"\nName:"<<"      ";
gets(name[index]);
cout<<"\nAddress:"<<"       ";gets(ad[index]);
cout<<"\nHobbies"<<"               ";gets(hobiz[index]);
cout<<"\nDislikes:"<<"               ";gets(dis[index]);
cout<<"\nAge:"<<"                ";gets(age[index]);
if(choiz==3){cout<<"\nThis Function lets you delete data in this sbook:";}
if(choiz==4){cout<<"\nThis function lets you view the list of the inputted data";}
cout<<"\nlisting all records:";
for(int a=0;a<=14;a++){
cout<<"\nName:"<<neym[a];cout<<"\nAddress:"<<adr[a];
cout<<"\nHobbies:"<<hobez[a];cout<<"\nDislikes:"<<ayaw[a];
cout<<"\nAge:"<<age[a];
if(choiz==5){cout<<"\nThis function lets you search the data inputted:";
for(int f=0;f<=14;f++){cout<<"\n"<<neym[f];cout<<"\n";adr[f];cout<<"\n"<<hobez[f];
cout<<"\n";ayaw[f];cout<<"\n"<<age[f];} }
if(choiz==6){cout<<"\nYou have exitted the program:";}
}}}


pls help,







getch();
}

Recommended Answers

All 3 Replies

You first need to learn how to format your code -- what you posted is a huge mess which I refuse to even try to read.

delete use of conio.h and studio.h -- this is a c++ program, not C.

Well You take in the data from the user and then again change it back....... With the strcopy(arg1,arg2) Function in main .

what ancient dragon said is correct. Your code isnt formatted at all. First of all, you need to learn that.

I would like to point out certain things though.

First of all, you need to decide which language you actually want to use - C or C++. It seems that you have included the iostream.h (a C++ header) file just to use 'cin' and 'cout'.

Also, i would like to point out the use of 'void main()' - The experts here had had warned me against using it. I am doing the same to you for just reasons. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.