-1
我不明白髮生了什麼事。我編了幾次程序,一切都很順利。但是由於我插入了#include <unordered_map>
,我得到錯誤,例如cout上的未聲明的標識符...沒有用於getline的重載函數的實例。我正在使用Visual Studio 10. 另外,如果有人能告訴我如何正確初始化unordered_map
,那就太好了。標識符cout未定義..和其他
#include "stdafx.h"
#include<string>
#include <iostream>
#include <sstream>
#include <unordered_map>
using namespace std;
unordered_map<string, dictionary * > Mymap;
int _tmain(int argc, _TCHAR* argv[])
{
string option;
string pass;
int choice=0;
unsigned char hash[20];
char hex_str[41];
while(choice!=4)
{
cout<< "Select an option:"<< endl;
cout<<"1. Basic Hashing"<<endl;
cout<<"2. Load Dictionary"<<endl;
cout<<"3. Decrypt"<<endl;
cout<<"4. Exit" <<endl;
getline(cin,option);
stringstream(option) >> choice;
if(choice == 1)
{
cout<<"Please enter a sample password"<<endl;
getline(cin,pass);
const char * c= pass.c_str();
sha1::calc(c,pass.length(), hash);
sha1::toHexString(hash,hex_str);
cout<<endl;
cout<<"Hashed: "<< hex_str<<endl;
}
else if(choice ==2)
{
string answer;
cout<<"Would you like to use the default dictionary file(d8.txt). Press y or n"<<endl;
getline(cin,answer);
}
}
return 0;
}
'using namespace std;'請停止這樣做。 – 2013-02-26 13:33:46
奇怪的部分是,只有第一cout給我的錯誤,但所有getlines顯示爲錯誤 – user1665569 2013-02-26 13:34:28
我試着把它拿出來,並使用std,但我得到錯誤,當我試圖調用std :: sha1 @nicolBolas – user1665569 2013-02-26 13:35:23