My project is to build a hotel menu and billing program. The problem is I have to use user defined functions to do it.

1st Function

int password(char usr_name[8], char pwd[]);
{
int j=0,k=0,i=0,m=0;
   corr[8]=pizzaboy;
     for(i=0;usr_name[i]!='\0';i++)
       {
	if (usr_name[i]=corr[i])
	n=1;
       }
       else
	n=0;
	po[5]=qwerty;
	for(j=0;pwd[j]!='/0';j++)
	{
	if (pwd[j]=po[j])
	m=1;
	else
	m=0;
	}
	if (m=1 && n=1)
	  {
	   k=1
	   }
	   else

The second function is to input the menu in 2-D array, and prices in 1-D array.
and display the Hotels name.

OUTPUT SCREEN

Hungry Kya??
Menu card
.............................................................................................................price
1. Burger .................................................................................................. 50
2. Patty .................................................................................................. 25

Now hoe do I get a function to take instructions many a times ??

I have been given the first line of the function

void Menu(char list[5][20], float price[5]);

Further, I have to store the users input in another array and give the total by comparing to the fuction.

I am done with the first function but the menu function is a real pain in the a*s.

>>I am done with the first function
No you are not. Did you try to compile it? Probably not. See below for some reasons why.

Your password function has several syntax errors:
line 4: corr[8]=pizzaboy;
What is that??? If you are attempting to declare a character array to contain the name pizzaboy then you have to do it like this: char corr[] = "pizzaboy"; or like this char corr[8] = "pizzaboy"; lines 11 - 24: are all those lines part of the else on line 10? If yes, then you need to surround them with braces { and }.

only line 11 is part of the else on line 10.

>> char corr[8] = "pizzaboy"

why 8 ?? since arr is counted with zero whay isnt it 7 ?? and please someone help me with the second function.

>>why 8 ?? since arr is counted with zero whay isnt it 7 ??
It should be 9, not 8. There are 8 characters in "pizzaboy" -- when counting the number of characters you have to start with 1, not 0. If you have a string like "p" it has 1 character not 0. I think you are confusing the way we index i nto the array. The first element of an array is 0, as shown below. That is not the same as the number of characters in the array.

corr[0] = 'p'
corr[1] = 'i'
corr[2] = 'z'
...
corr[8] = 0

Notice the last character in a string is the null-terminator 0. That's why the array must have at least 9 characters instead of 8.

As for your other problem, here's a hint how to do all those dots

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
    cout.fill('.');
    cout << "1. Burger " << setw(20) << "50\n";
    return 0;
}

char corr[8] = "pizzaboy"

it still giving syntax error:confused:

thanx trying btw itz not dots they were spaces.

Then just delete the fill() line that I posted.

char corr[8] = "pizzaboy"

it still giving syntax error:confused:

post new code please. And this time post the entire function, you left off the last few lines in your original post.

this billing function is still undone.... I am still working out the password function.Then again will try the menu fuction.
Anywayz thanx for the help. Close this thread plz. coz the menu fuction seems impossible.

this billing function is still undone.... I am still working out the password function.Then again will try the menu fuction.
Anywayz thanx for the help. Close this thread plz. coz the menu fuction seems impossible.

You giving up so soon? The function isn't impossible, you just haven't found the right solution. When you get really frustrated then its time to just leave it alone for a day or so then you can come back to the problem with a fresh mind.

I have posted all codes in the other thread to avoid confusion btw I am still clueless bout this fuction.

This article has been dead for over six months. Start a new discussion instead.