Hi,first i must say this is not my homework,because i am to young (14 Years old)to have programming homework.I am trying to make application for automation of the dental surgery(i am testing my skills :D),this is the program menu :

Ask for username and password and if it's correct it shows the main menu :

Add patient
Remove patient
Patient review
Modify patient
Search patient
Calculator
Exit

The program is in non english language but i think that is not important,important is the syntax.

If you compile this code you will see the errors that i also get when compiling,i tryed to fix it but i didnt find where is the error. Can you help me to find where is the error ?

Here is the code :

#include <iostream>
#include <windows.h>
#include <string>
#include <cstdlib>

using namespace std;

void Dodadi(void)
{

}   

void Odzemi(void)
{

} 

void Pregled(void)
{

} 

void Izmeni(void)
{

} 

void Baraj(void)
{

} 

void Kalkulator(void)
{

} 


int main()
{
string korisnik;
string lozinka;
char izbor;

system("Color 3F");
do {
do {
system("cls");
cout <<"\aKORISNIK : ";
cin >> korisnik;
cout <<endl;
}
while (korisnik != "DOKTOR123");
cout <<"\aLOZINKA : ";
cin >> lozinka;
cout <<endl;
}
while (lozinka != "LOZINKA123");
system("cls");

do {          
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | D |----------------------- DODADI PACIENT -------------------------| D |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;

    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | O |----------------------- ODZEMI PACIENT -------------------------| O |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;
   
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | P |----------------------- PREGLED NA PACIENTI ---------------------| P |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | I |----------------------- IZMENI PACIENT -------------------------| I |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | B |----------------------- BARAJ PACIENT --------------------------| B |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | K |----------------------- KALKULATOR -----------------------------| K |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | N |----------------------- IZLEZ ----------------------------------| N |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<endl;
    Beep (100,300);
    cin >> izbor;    
    if ((izbor=='d')||(izbor=='D')) {
    Dodadi();
    }
    if ((izbor=='o')||(izbor=='O')) {
    Odzemi();
    }
    if ((izbor=='P')||(izbor=='P')) {
    Pregled();
    }
    if ((izbor=='i')||(izbor=='I')) {
    Izmeni();
    }
    if ((izbor=='b')||(izbor=='B')) {
    Baraj();
    }
    if ((izbor=='k')||(izbor=='K')) {
    Kalkulator();
    }
    } 
    while ((izbor!='n') && (izbor!='N')); 
    return 0;
}   

system("PAUSE");
return 0;
}

This is the first help that i need for this c++ application,but because i am beginner i think i will need more help later with some code :D

Recommended Answers

All 11 Replies

#include <iostream>
#include <windows.h>
#include <string>
#include <cstdlib>

using namespace std;

void Dodadi(void)
{

}

void Odzemi(void)
{

}

void Pregled(void)
{

}

void Izmeni(void)
{

}

void Baraj(void)
{

}

void Kalkulator(void)
{

}


int main()
{
string korisnik;
string lozinka;
char izbor;

system("Color 3F");
do {
do {
system("cls");
cout <<"\aKORISNIK : ";
cin >> korisnik;
cout <<endl;
}
while (korisnik != "DOKTOR123");
cout <<"\aLOZINKA : ";
cin >> lozinka;
cout <<endl;
}
while (lozinka != "LOZINKA123");
system("cls");

do {
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | D |----------------------- DODADI PACIENT -------------------------| D |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;

    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | O |----------------------- ODZEMI PACIENT -------------------------| O |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;

    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | P |----------------------- PREGLED NA PACIENTI ---------------------| P |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;

    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | I |----------------------- IZMENI PACIENT -------------------------| I |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;

    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | B |----------------------- BARAJ PACIENT --------------------------| B |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;

    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | K |----------------------- KALKULATOR -----------------------------| K |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;

    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<"   | N |----------------------- IZLEZ ----------------------------------| N |"<<endl;
    cout<<"   |------------------------------------------------------------------------|"<<endl;
    cout<<endl;
    Beep (100,300);
    cin >> izbor;
    if ((izbor=='d')||(izbor=='D')) {
    Dodadi();
    }
    if ((izbor=='o')||(izbor=='O')) {
    Odzemi();
    }
    if ((izbor=='P')||(izbor=='P')) {
    Pregled();
    }
    if ((izbor=='i')||(izbor=='I')) {
    Izmeni();
    }
    if ((izbor=='b')||(izbor=='B')) {
    Baraj();
    }
    if ((izbor=='k')||(izbor=='K')) {
    Kalkulator();
    }
    }
    while ((izbor!='n') && (izbor!='N'));

}

The error was at the bottom :)

Hope I helped

Thanks buddy,yup you helped me but just for now :)
I was used to use system("pause"); and return 0; for all of my projects because i am using DevC++ and because i am beginner :)
Now i know why i get the errors,and i think it was logical error :)

Not a prob :) Could you please mark this as solved?

also, in your original code you used: system("PAUSE"); , I remember reading that it's not a good practice to use system

i suggest using sleep() declared in Windows.h :)

commented: don't beg for solved flags or rep points. it's tacky. -2

Hi,first i must say this is not my homework,because i am to young (14 Years old)to have programming homework.

that's ridiculous. 14 y.o. is High School, and you are certainly old enough to have homework in a programming class.

furthermore this is a typical standard homework problem.

i'm not saying that it is or isn't your assigned homework, but to say that it isn't because you're too young is just not credible.

>I'll try to help you to the best of my abilities, and if I did help you, please add to my
>rep ;D
ROFL.
I think begging is against rules or something isn't it?
Even I would have put that to my signature if DaniWeb could redeem those points with equivalent dollars ;)

@jephthah I'm not in highschool but i will be soon,i understand that you are concerned,because i know that a lot of people come here and ask for you to solve their problems without attempt a little,but i dont wanted you to finish my application,i just wanted you to solve some error,and i hope you can understand but have you heard of self-will project,that's what i am tryind to do :)

@athlon32 i would like to,but i think i will need more help later for this application because i am beginner :)

>I'll try to help you to the best of my abilities, and if I did help you, please add to my
>rep ;D
ROFL.
I think begging is against rules or something isn't it?
Even I would have put that to my signature if DaniWeb could redeem those points with equivalent dollars ;)

I'm not begging, it's just a friendly reminder ;)

commented: Yes, far too much stuff goes "unsolved" and unrecognised +36

Just improvement,
In python there is lower() function that makes it easier to test. So in python, instead of

if ((izbor=='d')||(izbor=='D'))

You have

if izbor.lower()=="d"

I'll check for C++ equivalent. I do a lot in Py and few of C++ :)

Thanks for your advice ;)

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.