#include <iostream>
#include <fstream>
#include <string>
#include <conio.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>


using namespace std;



// Subprogram pentru Admin

void Login(string& admin ,string& password)
{
    string Users[200];
    string Pass[200];
    bool valid = false;

    void AdminOptions();

    int x = 0;
    ifstream UsFile;
    UsFile.open("admin.txt");

    UsFile >> Users [x] >> Pass [x];

    while (UsFile)  //read username and password from file and store tjem in arrrays
    {
        x++;
        if (x >= 200)
            break;
        UsFile >> Users[x] >> Pass [x];
    }

    for (int a=0;a<x;a++)
    {
        if(admin == Users[a] && password == Pass[a])
        {
            system("cls");
            cout<<"+----------------------------+"<<endl;
            cout<<"| You Successfully Logged In |"<<endl;
            cout<<"+----------------------------+"<<endl;
            valid = true;
            break;
        }if(valid = false)
            {
            cout<<"          "<<"+-----------+"<<endl;
            cout<<"          "<<"| Try Again |"<<endl;
            cout<<"          "<<"+-----------+"<<endl;
            void Login(string& admin ,string& password);
            }
    }
};
///////////////////////////////////////////////////////

void AdminOptions()
{
    int i;
    system("pause");
    system("cls");

    cout<<"          "<<"+-------------------------------+"<<endl;
    cout<<"          "<<"| Welcome to Administrator Menu |"<<endl;
    cout<<"          "<<"+-------------------------------+"<<endl;
    cout<<endl;
    cout<<endl;
    cout <<"                          "<< char(201) ; for(i=1;i<=40;i++){ cout << char(205);}; cout << char(187)<<endl;
    cout <<"                          "<< char(186) << "       Seleteaza operatiune dorita:   " << char(186) << endl;
    cout <<"                          "<< char(204); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(203); for(i=1;i<=34;i++){ cout << char(205);};cout << char(185) << endl;
    cout <<"                          "<< char(186) << "  1  " << char(186) << "          Add new Flowers       " << char(186) << endl;
    cout <<"                          "<< char(204); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(206); for(i=1;i<=34;i++){ cout << char(205);};cout << char(185) << endl;
    cout <<"                          "<< char(186) << "  2  " << char(186) << "        Display all flowers     " << char(186) << endl;
    cout <<"                          "<< char(204); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(206); for(i=1;i<=34;i++){ cout << char(205);};cout << char(185) << endl;
    cout <<"                          "<< char(186) << "  3  " << char(186) << "          Search Flowers        " << char(186) << endl;
    cout <<"                          "<< char(200); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(202); for(i=1;i<=34;i++){ cout << char(205);};cout << char(188) << endl;
    cout <<"                          "<< char(186) << "  4  " << char(186) << "          Delete Flowers        " << char(186) << endl;
    cout <<"                          "<< char(200); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(202); for(i=1;i<=34;i++){ cout << char(205);};cout << char(188) << endl;
    cout <<"                          "<< char(186) << "  5  " << char(186) << "          Update Flowers        " << char(186) << endl;
    cout <<"                          "<< char(200); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(202); for(i=1;i<=34;i++){ cout << char(205);};cout << char(188) << endl;
    cout <<"                          "<< char(204); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(203); for(i=1;i<=34;i++){ cout << char(205);};cout << char(185) << endl;
    cout <<"                          "<< char(186) << "  5  " << char(186) << "            View Offers         " << char(186) << endl;
    cout <<"                          "<< char(204); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(206); for(i=1;i<=34;i++){ cout << char(205);};cout << char(185) << endl;
    cout <<"                          "<< char(186) << "  6  " << char(186) << "         View Login Report      " << char(186) << endl;
    cout <<"                          "<< char(204); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(206); for(i=1;i<=34;i++){ cout << char(205);};cout << char(185) << endl;
    cout <<"                          "<< char(186) << "  7  " << char(186) << "                Help            " << char(186) << endl;
    cout <<"                          "<< char(200); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(202); for(i=1;i<=34;i++){ cout << char(205);};cout << char(188) << endl;
    cout <<"                          "<< char(186) << "  8  " << char(186) << "        Return to Main Menu     " << char(186) << endl;
    cout <<"                          "<< char(200); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(202); for(i=1;i<=34;i++){ cout << char(205);};cout << char(188) << endl;
}

void SearchOptions()
{
    system("cls");
    cout<<"\n\t Search Flowers"<<endl;
    cout<<"\t-----------------\n\n"<<endl;
    cout<<"\n\t1 : Search Flower by |ID|" <<endl;
    cout<<"\n\t2 : Search Flower by |Category|" <<endl;
    cout<<"\n\t3 : Search Flower by |Name|" <<endl;
    cout<<"\n\t4 : Search Flower by |Price|" <<endl;
    cout<<"\n\t0 : Back to Admin Menu" <<endl;
}

void UpdateOptions()
{
    system("cls");
    cout<<"\n\t Update Flower"<<endl;
    cout<<"\t-----------------\n\n"<<endl;
    cout<<"\n\t1 : Search & Update Flower by |ID|" <<endl;
    cout<<"\n\t2 : Search & Update Flower by |Category|" <<endl;
    cout<<"\n\t3 : Search & Update Flower by |Name|" <<endl;
    cout<<"\n\t4 : Display list and update" <<endl;
    cout<<"\n\t0 : Back to Admin Menu" <<endl;
}

void DeleteOptions()
{
    system("cls");
    cout<<"\n\t Update Flower"<<endl;
    cout<<"\t-----------------\n\n"<<endl;
    cout<<"\n\t1 : Search & Delete Flower by |ID|" <<endl;
    cout<<"\n\t2 : Search & Delete Flower by |Category|" <<endl;
    cout<<"\n\t3 : Search & Delete Flower by |Name|" <<endl;
    cout<<"\n\t4 : Display List and Delete" <<endl;
    cout<<"\n\t0 : Back to Admin Menu" <<endl;
}

void Guest()
{
    system("cls");
    cout<<"\n\t Welcome To Flower Point"<<endl;
    cout<<"\t----------------------\n\n"<<endl;
    cout<<"\n\t1 : View our |ShopList|" <<endl;
    cout<<"\n\t2 : Search & Update Flower by |Category|" <<endl;
    cout<<"\n\t3 : Search & Update Flower by |Name|" <<endl;
    cout<<"\n\t0 : Back to Guest Menu" <<endl;
}



int main()
{
    int a,b,c,n,m,i,j;
    int error;
    void Login(string& admin ,string& password);
    void Staff(string& user , string& pass1);
    void AdminOptions();
    void DeleteOptions();
    void SearchOptions();
    void UpdateOptions();

    cout<<"                                       $ Welcome to =FlowerPoint="<<endl;
    cout<<endl;
    cout<<"                                       Choose a color of the text "<<endl;
    cout<<endl;
    cout<<endl;
    cout<<"1|- red color"<<endl;
    cout<<"2|- green color"<<endl;
    cout<<"3|- blue color"<<endl;
    cout<<"4|- yellow color"<<endl;
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<"            - This is a shop where flowers are grown with love and then they are sold to you -"<<endl;
    cout<<endl;
    cout<<"This is a flower shop where you can find all kinds of flowers like ,roses ,tulips, lilies, daffodils, etc. Its a shop \n\                           with low $ prices and with a big a wide range of flowers "<<endl;
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<endl;
    cout<<"                            THANK YOU FOR CHOSING OUR SHOP with love -FlowerPoint-";

    c = getch();

    switch(c)
    {
        case '1' : system("Color 4");break;
        case '2' : system("Color A");break;
        case '3' : system("Color 3");break;
        case '4' : system("Color 6");break;
    }

    system("CLS");

    i = 0;
     char load[26];
     while(i < 25)
     {
         system("DATABASE");
         load[i++] = char(219);
         load[i] = char(0);

        printf("\n\nLOADING [%-25s]", load);
         usleep(199900);
     }

    system("CLS");
    printf("\n");

    int choice;
    string User,password;
    cout<<"\n\tThis application lets you to view & search about Flowers available in FlowerPoint"<<endl;
    cout<<"\t****************************** FlowerPoint ************************************"<<endl;
    cout<<endl;
    cout<<endl;
    do{
        cin.clear();
        cout <<"                          "<< char(201) ; for(i=1;i<=34;i++){ cout << char(205);}; cout << char(187)<<endl;
        cout <<"                          "<< char(186) << "   Seleteaza operatiune dorita:   " << char(186) << endl;
        cout <<"                          "<< char(204); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(203); for(i=1;i<=28;i++){ cout << char(205);};cout << char(185) << endl;
        cout <<"                          "<< char(186) << "  1  " << char(186) << "          Admin             " << char(186) << endl;
        cout <<"                          "<< char(204); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(206); for(i=1;i<=28;i++){ cout << char(205);};cout << char(185) << endl;
        cout <<"                          "<< char(186) << "  2  " << char(186) << "          Guest             " << char(186) << endl;
        cout <<"                          "<< char(204); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(206); for(i=1;i<=28;i++){ cout << char(205);};cout << char(185) << endl;
        cout <<"                          "<< char(186) << "  3  " << char(186) << "          <Exit>            " << char(186) << endl;
        cout <<"                          "<< char(200); for(i=1;i<=5;i++){ cout << char(205);}; cout << char(202); for(i=1;i<=28;i++){ cout << char(205);};cout << char(188) << endl;
        do{
            error = 0;
            cout<<endl;
            cout<<"\n\tPlease enter your selection :";
            cin>>choice;
            if(cin.fail())
            {
                cout<<endl;
                cout<<"\n\t[ERROR]Please enter a valid input."<< endl;
                error = 1;
                cin.clear();
                cin.ignore(80, '\n');
            }

        }while (error == 1);

        switch(choice)
        {
            case 1:   {
                       system("cls");
                       cout<<"          "<<"+-----------+"<<endl;
                       cout<<"          "<<"| Username :|";cin>>User;
                       cout<<"          "<<"+-----------+"<<endl;
                       cout<<"          "<<"| Password :|";cin>>password;
                       cout<<"          "<<"+-----------+"<<endl;
                       Login(User, password);
                      }break;

            case 2:   {
                        system("cls");
                        cout<<"          "<<"+-------------------+"<<endl;
                        cout<<"          "<<"| Logged Like Guest |"<<endl;
                        cout<<"          "<<"+-------------------+"<<endl;

                      }break;
        }

    }while(choice != 0);


    return 0;
}
Help Please

Here is a shop where you can enter like an Admin [txt file (here is "admin.txt" ]
if the password and username is identic to show the (Void AdminMenu) with all choices

or like a guest it simply shows you a menu of a guest help me please to make this aplication please guys

Add the txt file "admin.txt" on your PC to make it work
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.