Som besökare på Hamsterpaj samtycker du till användandet av s.k. cookies för att förbättra din upplevelse hos oss. Jag förstår, ta bort denna ruta!
Annons

If statement i if statement? c++

Skapad av Borttagen, 2011-12-31 00:00 i Webbutveckling & Programmering

4 407
16 inlägg
0 poäng
Grepolis
Visningsbild
Hjälte 1 384 inlägg
0
Började med c++ nyligen och har gjort ett litet program som första gången man startar det ska låta en skriva in ett lösen ord sen spara en "hemlighet"

sen nästa gång när man startar det så ska man först behöva skriva in lösenordet sen så ska "hemligheten" stå där

sen ska jag bygga vidare efter det men just nu ska jag bara försöka få det första att funka

Men självklart får man typ 1000 errors (Bokstavligt talat)
errorn längst ner fattar jag vad iallafall det är att jag har if statement i ett ifstatement.. :/

Nån som kan c++ som skulle kunna hjälpa mig att fixa koden??



Koden:
Visa spoiler
#include <iostream>
#include <fstream>
#include <string>

using namespace std;
using std::string;

int main () {

fstream filestr;
filestr.open ("pass.txt");
if (filestr.is_open())

{
filestr.close();

string pass;
string password;

ofstream myfile;
myfile.open ("pass.txt");
myfile >> pass;
cout << "Write your password
Password: ";
cin >> password;

if (password==pass);
{
ofstream secretfil;
myfile.open ("secret.txt");
myfile << "Writing this to a file.
";
myfile.close();
}
else
{
cout << "wrong password";
}
myfile.close();

}

else
{
cout << "blablabla"; // här ska man skriva in sitt lösenord och hemlighet om det är första gången man startar programmet, fixar det när "första delen" är klar :P
}
return 0;
}

Trolololo

Är reklamen ivägen? Logga in eller registrera dig så försvinner den!

gaminggirl
Visningsbild
F 38 Lund Hjälte 8 084 inlägg
0

Svar till Grepolis [Gå till post]:
Lämpligen lämna felmeddelandena också då.

Ingen status

Grepolis
Visningsbild
Hjälte 1 384 inlägg
Trådskapare
0
fan vad konstigt det såg ut när saker o ting inte är framskjutet o så

lägger snart upp en screenshot istället

Trolololo

Grepolis
Visningsbild
Hjälte 1 384 inlägg
Trådskapare
0
Forum image

Trolololo

Grepolis
Visningsbild
Hjälte 1 384 inlägg
Trådskapare
0
alla felmedelanden
Visa spoiler
1>------ Build started: Project: passwd, Configuration: Debug Win32 ------
1>Build started 2011-12-31 00:04:29.
1>InitializeBuildStatus:
1> Touching "Debugpasswd.unsuccessfulbuild".
1>ClCompile:
1> passwd.cpp
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludestring(458) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludestring(458) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludestring(458) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludestring(458) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludestring(458) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludestring(344) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludestring(344) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludestring(344) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludestring(344) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludestring(344) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Ty &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1128) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Ty &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1128) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Ty &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1128) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Ty &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1128) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Ty &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1128) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1118) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1118) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1118) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1118) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1118) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1111) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1111) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1111) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1111) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1111) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1104) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1104) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1104) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1104) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1104) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1097) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1097) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1097) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1097) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1097) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1090) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1090) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1090) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1090) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1090) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1082) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1082) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1082) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1082) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1082) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1074) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1074) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1074) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1074) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1074) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1067) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1067) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1067) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1067) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,unsigned char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1067) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1060) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1060) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1060) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1060) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,signed char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1060) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1053) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1053) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1053) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1053) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<char,_Traits> &std;::operator >>(std::basic_istream<char,_Traits> &&,signed char *)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1053) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1028) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1028) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1028) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1028) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Elem &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(1028) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(987) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(987) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(987) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(987) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2784: 'std::basic_istream<_Elem,_Traits> &std;::operator >>(std::basic_istream<_Elem,_Traits> &&,_Elem *)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ofstream'
1> c:program files (x86)microsoft visual studio 10.0vcincludeistream(987) : see declaration of 'std::operator >>'
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(22): error C2676: binary '>>' : 'std::ofstream' does not define this operator or a conversion to a type acceptable to the predefined operator
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(27): warning C4390: ';' : empty controlled statement found; is this the intent?
1>c:usersoozfobdocumentsvisual studio 2010projectspasswdpasswdpasswd.cpp(33): error C2181: illegal else without matching if
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.53
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Trolololo

pr0n
Visningsbild
P Hjälte 5 588 inlägg
0
Svar till Grepolis [Gå till post]:
Kan man verkligen jämföra strängar så i C++?

Tror du får använda dig utav strcmp istället :)
http://www.cplusplus.com/reference/clibrary/cstring/strcmp/

Men jag kan ha fel.


Ingen status

Grepolis
Visningsbild
Hjälte 1 384 inlägg
Trådskapare
0

Svar till pr0n [Gå till post]:
ingen aning :P
mycket möjligt att det inte går, drygt isåfall :P

Trolololo

pr0n
Visningsbild
P Hjälte 5 588 inlägg
0

Svar till Grepolis [Gå till post]:
Skulle helt enkelt bli såhär

if(strcmp(pass, password)){
// Rätt lösenord
}


Ingen status

gaminggirl
Visningsbild
F 38 Lund Hjälte 8 084 inlägg
0
Svar till Grepolis [Gå till post]:
Är du säker på att det som står i din if-sats gör som du tänkt, det är där felet är någonstans enligt felmeddelandena också... Är det verkligen myfile du vill ändra på och i så fall varför skapar du secretfil?
if-sats som i if(pass==password)

Ingen status

Grepolis
Visningsbild
Hjälte 1 384 inlägg
Trådskapare
0

Svar till gaminggirl [Gå till post]:
förstår inte riktigt hur du menar nu :P
Har kopierat endel från olika sidor så det kanske gör att det ser lite konstigt ut
Men jag vill att man ska få välja lösenord första gången man startar programmet
sen när man valt det ska man få skriva in en hemlighet

sen nästa gång när man startar programmet så ska man få skriva in lösenordet och efter det ska man se hemligheten


Är ju ganska noobig på detta så om någon som kan skulle kunna slänga ihop en egen kod (Som låter en välja password förstagången och sen frågar efter det nästa gång) så vore det jävligt nice :)

Trolololo

Gurrewe
Visningsbild
P 30 Bromma Bästis För många inlägg
0

Svar till Grepolis [Gå till post]:
Tänk på att det bara är att öppna de där filerna med vilken textredigerare som helst och läsa allt i klartext.

/party

Grepolis
Visningsbild
Hjälte 1 384 inlägg
Trådskapare
0

Svar till Gurrewe [Gå till post]:
jag vet men jag är somsagt noob och ska fixa säkerheten när programmet funkar :)

Trolololo

Tvillingen
Visningsbild
P 31 Hjälte 3 117 inlägg
0
Såg något jag antar är fel även i C++

if(password == pass);

Ta bort semikolon där (:

Jag är ond!

gaminggirl
Visningsbild
F 38 Lund Hjälte 8 084 inlägg
0

Svar till Grepolis [Gå till post]:
if (password==pass);
{
ofstream secretfil;
myfile.open ("secret.txt");
myfile << "Writing this to a file.
";
myfile.close();
}

Är tanken att du ska fortsätta använda myfile där eller tanken var att du skulle använda secretfil. Tvillingen har rätt i en sak också, du ska inte ha semikolon efter if.

Ingen status

Grepolis
Visningsbild
Hjälte 1 384 inlägg
Trådskapare
0

Svar till gaminggirl [Gå till post]:
hmm ok

skulle nån som kan detta bara kunna slänga ihop ett program?

Trolololo

Kae
Visningsbild
P 32 Västra Frölunda Hjälte 6 659 inlägg
0
Ett tips ej anknutet till problemet är att använda pastebin. Mycket enklare att lägga upp din kod där. Så slipper du mecka med screenshots eller HPs mer eller mindre användbara kodtaggar :)

Forum » Datorer & IT » Webbutveckling & Programmering » If statement i if statement? c++

Ansvariga ordningsvakter:

Användare som läser i den här tråden just nu

1 utloggad

Skriv ett nytt inlägg

Hej! Innan du skriver om ett potentiellt problem så vill vi påminna dig om att du faktiskt inte är ensam. Du är inte onormal och världen kommer inte att gå under, vi lovar! Så slappna av och gilla livet i några minuter - känns det fortfarande hemskt? Skriv gärna ner dina tankar och frågor, vi älskar att hjälpa just dig!

Den här tråden är äldre än Rojks drömtjej!

Det senaste inlägget i den här tråden skrevs för över tre månader sedan. Är du säker på att du vill återuppliva diskussionen? Har du något vettigt att tillföra eller passar din fråga i en ny tråd? Onödiga återupplivningar kommer att låsas så tänk efter en extra gång!

Hjälp

Det här är en hjälpruta

Här får du korta tips och förklaringar om forumet. Välj kapitel i rullningslisten här ovanför.

Rutan uppdateras automagiskt

När du använder funktioner i forumet så visas bra tips här.


Annons
Annons
Annons
Annons