#include<iostream>
#include<conio.h>
usingnamespace std;
int a,b;
char id2;
int f1();
int main()
{
cout<<"PASSWORD= ";
while(a!=13)
{
int f1();
if(a<400)
{
cout<<"&";
}
}
}
int f1()
{
a=getch();
std::cout << "value of a: " << a << std::endl;if(a==0||a==240){a=500;b=getch();}
}
You've been here ages now. Start thinking about how to solve these problems for yourself. Debugging starts simple. Just output the values and see what they are.
int getch();
that's the prototype of `getch()', note how you are calling it a=getch();
you simply write the name of the function, and between parenthesis pass all the needed parameters.
now see what you're doing with `f1()'.
1 2 3
while(a!=13)
{
int f1();
¿why do you have `int' there? that's not a function call, which should be simply f1();
So you've got an infinite loop because `a' never changed because `f1()' was never called.
you are absolutely right
see what i am doing with int f1()
that's not a function call which should be simply f1();
so i have got an infinite loop because a never has changed because