| ezadmarzuki (2) | |
|
got a few failed.. but i dont know how to know what it is.. help me please #include <iostream> using namespace std; void main() { char User_Name [30]; char Ic_Number [30]; char House_Name [30]; double Come_Back_Time; int a; int password (a = 1234); int *ptrPointer; ptrPointer = &a; do { cout<<"Please enter your password :"; cin>>a; cout<<"True"<<endl; cout<<"Enter the User_Name :"; cin>>User_Name; cout<<"Enter your Ic_Number :"; cin>>Ic_Number; cout<<"Enter the House_Name :"; cin>>House_Name; cout<<"Your Come_Back_Time is :"; cin>>Come_Back_Time; cout<<"\n\n\t\t\t\t Welcome "<<User_Name<<endl; cout<<"\n\t\t Your Ic Number is :"<<Ic_Number<<endl; cout<<"\n\t\t Your Come Back Time today is :"<<Come_Back_Time<<endl; if (Come_Back_Time <= 17.00) { cout<<"\n\t\t You are :Early"<<endl; } else { cout<<"\n\t\t You are :Late"<<endl; } while(a!=1234) cout<<"Try again"<<endl; } } | |
|
|
|
| Moschops (5956) | |
void main() is not C++. In C++, main returns an int.int password (a = 1234); Are you trying to set the variable a with a value, or create a new variable, or both, or what?If that while is meant to be the end of a do-while loop; if you indent your code properly, you will see that you have got your braces wrong. The do loop isn't closed properly, and also you're missing a semi-colon after the while. | |
|
Last edited on
|
|
| Chervil (803) | |||||
It's hard to understand the meaning (or even the intended meaning) of this code without proper indentation. If you use code tags [code]like this[/code] - use the <> formatting button on the right, it will help.
Now - it can be seen that there is a do-while loop which starts on line 14 and ends on line 46. But there is no "while" at line 46. It should be something like this:
Also lines 44-45 are a while loop which controls a single cout statement . This is probably not what was intended. | |||||
|
Last edited on
|
|||||