The programme you guyz helped me with for the past 3-4 weeks is done.......It was done last week but I had exams.

hrez the code :) you guyz can execute and see it :P

Thanx ancient dragon and nieke

// password fuction
 #include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<string.h>

int password()
{
int j=0,k=0,i=0,m=0,n=0,c=0,v=(-1);
char usr_name[20], pwd[20];


char corr[] = "pizzaboy";
 cout<<"Enter username "<<endl;
   gets(usr_name);

     for(i=0;usr_name[i]!='\0';i++)
       {
	if (usr_name[i]== corr[i] && strlen(usr_name)==strlen(corr))
	n=1;
       else
	n=0;
       }
	char po[] = "qwerty";

    attemp:

    v=-1;
    cout<<"Enter password"<<endl;
    do
    {
    v++;
    pwd[v]=getch();
    cout<<"*";
    }while(pwd[v]!=13);
    pwd[v]='\0';


	for(j=0;pwd[j]!='\0';j++)
	{
	if (pwd[j]== po[j] && strlen(pwd)==strlen(po))
	m=1;
	else
	m=0;
	}
		 if(m==0)
		    {
		    c++;

			 if(c == 3)
			      {
			       cout<<"3 of 3 login attempts failed.. press any key to exit"<<endl;
			       getch();
			       exit(0);
			      }
		      cout<<c<<" out of 3 login attmpts failed"<<endl;
		    goto attemp ;
		     }
	if (m==1 && n==1)
	   k=1;
	   else
	   k=0;

	  return (k);
	   }

     // fn2
     #include<iomanip.h>
#include<iostream.h>
#include<conio.h>
void menu ( char arr[20][50],int price[20],int no)
{
 int k,c=1;
 cout<<"=============================================================\n";
 cout<<"                 Take away menu                              \n";
 cout<<"=============================================================\n\n\n\n\n";

cout<<setw(15)<<"       Item"<<setw(20)<<"price"<<endl<<endl;
for(k=0; k<no; k++)
{
    cout<<setw( 10)<<" "<<c<<") "<<arr[k]<<setw(15)<<price[k]<<endl;
    c++;
}
 }



#include<iomanip.h>
#include<iostream.h>
#include<conio.h>
#include<stdio.h>


void main()
  {
   clrscr();

   char ur[10],pass[10],arr[20][50];
    int y,i,item,price[20],no,itno=0,e,q=0,l=0;
    /* =====================================
	LOGIN SCREEN
       ===================================== */

   cout<<"Login"<<endl<<endl;
   y=password();
   if(y==1)
   {
   cout<<"Correct Username and password !! Enter please"<<endl;
   cout<<"\n\n\n\npress any key to continue..........";
   }
   getch();
   if(y==0)
   {
   cout<<endl<<"WRONG  USERNAME"<<endl;
   cout<<"Extra chances only for wrong pass none for wrong usr"<<endl;
   cout<<"\npress any key to exit";
   getch();
   exit(0);

   }

  /* ========================================
	MANAGER'S SCREEN-
	Input of Hotel's menu.
     ======================================== */
     clrscr();
     cout<<"    ================================================================="<<endl;
     cout<<"                     Food on the run Restaurant              "<<endl;
     cout<<"                          Hungry Kya ??                      "<<endl<<endl;
     cout<<"    ================================================================="<<endl;
     cout<<"Manager's screen"<<endl<<endl;
     cout<<"Enter how many items to be there in the menu"<<endl;
     cin>>no;
     cout<<"Enter today's menu\n\n"<<endl;
     for(i=0; i<no; i++)// row icrement
       {
       cout<<"Enter the item:"<<endl;
       gets(arr[i]);   // Input of colums i.e name string.
       cout<<"\n";
       cout<<"Enter the price of the item"<<endl;
       cin>>price[i];
       cout<<"\n\n";
       }
       clrscr();
       // calling fuction menu to display list
       menu(arr,price,no);

      /*============================================================
	  Display
	============================================================ */
	cout<<"      =================================================\n";
	cout<<"                    Hungry Kya                         \n"<<setw(25);
	cout<<"      =================================================\n\n";


	cout<<"The number of items you'll inp"<<endl;
	cin>>itno;
	cout<<"To order,Input the serial number of the item,hit ENTER\n";
	cout<<"then enter the quantity and hit enter.Repeat the process "<<itno<<" times\n\n";


	cout<<"Item     "<<setw(20)<<"Unit Price"<<setw(10)<<"Q.orderd"<<setw(10)<<"Total\n\n";

	for(e=0; e<itno; e++)
	{
	setw(0);cin>>item>>q;// quantity of the item.
	cout<<arr[item-1]<<setw(20)<<price[item-1]<<setw(10)<<q<<setw(10)<<price[item-1]*q<<endl<<endl;
	l=(l+(price[item-1]*q));
	}
	 cout<<setw(45)<<"total"<<l;
     getch();
     }

what compiler are you using?

#include<iostream.h> is bad

t c++ v.3

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.