Using struct in function. Allows me to declare, but wont let me call.
Here is my code..
Code:
#include <iostream>
#include <stdlib.h>
int bill(struct info(int id, int pass));
struct info
{
int id;
int pass;
};
int main(int argc, char *argv[])
{
system("PAUSE");
return 0;
}
int bill(struct info(int id, int pass))
{
info bill;
{
bill.id;
bill.pass;
}
for(bill.id=0; bill.id != 123; bill.id++)
{cout<<"What is your 3 digit id?\n";
cin>>bill.id;
if(bill.id==3)
{ break;
return 0;
}
if(bill.id==123)
{
cout<<"ID is correct.";
}
if(bill.id!=123)
{
cout<<"ID is incorrect. Please try again";
}
}
for(bill.pass=0; bill.pass != 321; bill.pass++)
{
cout<<"What is your 3 digit password?\n";
cin>>bill.pass;
if(bill.pass==3)
{
break;
return 0;
}
if(bill.pass==321)
{
cout<<"Pass is correct";
}
if(bill.pass!=321)
{
cout<<"Pass is incorrect";
}
}
}
I want it to ask for the id and password of a user. Declare the struct inside the function but it wont let me call the function with the struct inside of main. Please help.