-2
#include "stdafx.h"
#include <iostream>
#include <conio.h>

int main()
{
    int choice,num1,num2,num3,num4,result;

    cout<<"NOTE:PASSWORD IS HIHGLY ENCYRPTED BETWEEN EACH 2 NUMBERS a + Sign!!!!"<<endl;
    cout<<"Choose where you want to go:"<<endl;
    cout<<"1-Wifi password list"<<endl;
    cout<<"2-Facebook Password & Email"<<endl;
    cin>>choice;
    cout<<"Please Enter the password to continue:"<<endl;
    cin>>num1>>num2>>num3>>num4;

    switch(choice)
    {
    case 1: if (result==100)
            {
                cout<<"!!!!!Congratz you are Proffesional Cracker!!!!!"<<endl;
                break;
            }
            else
            {
        result=num1+num2+num3+num4
            cout<<"The sum of the Numbers aren't equal to the encyrpted number! try again"<<endl;
            break
            }
    }



    return 0;
}

i am making this project that if he choose case 1: ...... the "IF" show if result==100 then to cout<<"You are proffesinal cracker"<

but after compiling errors displayed in output

1>------ Build started: Project: login, Configuration: Debug Win32 ------ 1> stdafx.cpp 1> login.cpp 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(12): error C2065: 'cout' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(12): error C2065: 'endl' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(13): error C2065: 'cout' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(13): error C2065: 'endl' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(14): error C2065: 'cout' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(14): error C2065: 'endl' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(15): error C2065: 'cout' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(15): error C2065: 'endl' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(16): error C2065: 'cin' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(17): error C2065: 'cout' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(17): error C2065: 'endl' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(18): error C2065: 'cin' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(24): error C2065: 'cout' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(24): error C2065: 'endl' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(30): error C2146: syntax error : missing ';' before identifier 'cout' 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(30): error C2065: 'cout' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(30): error C2065: 'endl' : undeclared identifier 1>c:\users\mycomm\desktop\gallery\c++\login\login\login.cpp(32): error C2143: syntax error : missing ';' before '}' ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

please review my code and help

1 Answers1

1

The compiler does not recognise cout in this context. You should refer the scope of cout with the scope operator ::

cout is part of the std namespace.

So wherever you have cout, substitute it with std::cout. The same is part with endl -> std::endl. The same applies to cin -> std::cin. Alternatively use '\n' instead of std::endl.

Just for further knowledge:

You could add using namespace std; in the top of your code. But, it is not normally suggested because of the best answer provided in this question.

And some advice:

Your switch statement is redundant, since you only evaluate if a value is ONE SINGLE option. You can change it with a normal if statement and then nest your existing if statement inside. Check switch statement documentation to see when it is more appropriate to use it.

Santiago Varela
  • 2,199
  • 16
  • 22