-
March 7th, 2012, 02:10 PM
#1
Help definition
Code:
int main()
{
std::string SPEACH;
std::string WOrt;
std::string KUNDE;
std::string KUNDEN;
std::string WORDS;
std::string ENTRE;
std::string DEFINITION;
std::string ALLES;
std::string NOMEN;
{
cout << "\n Whats your name? \n";
set<string> KUNDE;
{ ifstream in("Kunden.h");
for(string wort; in >> wort;)
KUNDE.insert(wort);
}
{ for(string wort; cin >> wort;)
if (KUNDE.count(wort))
goto NEXT4;
else
goto NEXT4;
}
}
{NEXT4:
cout << "I don't know you. Where do you life? \n";
fstream datei6;
datei6.open("speach.h", ios::app);
cin >>SPEACH;
{ set<string> namen;
{ cout << "Gib deinen Namen ein";
ifstream in("Kunden.h");
for(string wort; in >> wort;)
namen.insert(wort);
}
{ for(string wort; cin >> wort;)
if (namen.count(wort))
goto NEXT2;
else
{ cout << "I don't know the wort " << wort << " Is it a Nomen or a Name?";
cin >> WORDS;
{fstream datei1;
fstream datei2;
if (WORDS == "Nomen")
{ { datei1.open("Nomen1.h", ios::app);
datei2.open("Nomen2.h", ios::app);
{ cout << "Wie lautet der Singular?" << endl;
cin >> ENTRE;
datei1 <<"\n" << ENTRE << endl; }
}
{ cout << "Bitte definieren Sie den Begriff mit einem Wort" << endl;
cin >> DEFINITION;
datei2 << DEFINITION << endl; }
}
else if (WORDS == "Name")
{ datei1.open("Name.h1", ios::app);
{ cout << "Wer ist das?" << endl;
cin >> ENTRE;
datei1 <<"\n" << ENTRE << "\n " << endl; } }
datei1 << ENTRE << endl;
datei2 << ENTRE << endl;
} } } }
{ NEXT2:
cout << "."; }} }
I can save definitions or names, but I can't access DEFINITION or NAMEN/Nomen! What I want:
Entre a word, it checks if it's still there.
If not, it will save the word and it's definition.
I need:
If I entre a word, the PC must entre me the other word back.
Thanks
Last edited by derdude007; March 7th, 2012 at 02:56 PM.
-
March 7th, 2012, 02:14 PM
#2
Re: Help definition
Yuck.
Use code tags and fix the indentation. I wouldn't want to even begin to figure out what's going on in there. Never do things like
} } } }
on the same line.
-
March 7th, 2012, 02:17 PM
#3
Re: Help definition
I just made }}} because I won't need a lot of place!
But what do you mean with "Use code tags and fix the indentation."?
A bit accurate pleas, I'm new! Thanks your help
-
March 7th, 2012, 02:20 PM
#4
Re: Help definition
I mean without proper indentation and properly aligned braces, your code is impossible to read.
http://www.codeguru.com/forum/announcement.php?f=7
-
March 7th, 2012, 02:21 PM
#5
Re: Help definition
[ c o d e ] "code" [ / c o d e ]
Code:
Will make code look like this
-
March 7th, 2012, 02:57 PM
#6
-
March 7th, 2012, 03:11 PM
#7
Re: Help definition
If anyone was going to try and help him here is the code with indentation. Or atleast what I could make of the indentation...?
Code:
int main()
{
std::string SPEACH;
std::string WOrt;
std::string KUNDE;
std::string KUNDEN;
std::string WORDS;
std::string ENTRE;
std::string DEFINITION;
std::string ALLES;
std::string NOMEN;
{
cout << "\n Whats your name? \n";
set<string> KUNDE;
{
ifstream in("Kunden.h");
for(string wort; in >> wort;)
KUNDE.insert(wort);
}
{
for(string wort; cin >> wort;)
if (KUNDE.count(wort))
goto NEXT4;
else
goto NEXT4;
}
}
{
NEXT4:
cout << "I don't know you. Where do you life? \n";
fstream datei6;
datei6.open("speach.h", ios::app);
cin >>SPEACH;
{
set<string> namen;
{
cout << "Gib deinen Namen ein";
ifstream in("Kunden.h");
for(string wort; in >> wort;)
namen.insert(wort);
}
{
for(string wort; cin >> wort;)
if (namen.count(wort))
goto NEXT2;
else
{
cout << "I don't know the wort " << wort << " Is it a Nomen or a Name?";
cin >> WORDS;
{
fstream datei1;
fstream datei2;
if (WORDS == "Nomen")
{
{
datei1.open("Nomen1.h", ios::app);
datei2.open("Nomen2.h", ios::app);
{
cout << "Wie lautet der Singular?" << endl;
cin >> ENTRE;
datei1 <<"\n" << ENTRE << endl;
}
}
{
cout << "Bitte definieren Sie den Begriff mit einem Wort" << endl;
cin >> DEFINITION;
datei2 << DEFINITION << endl;
}
}
else if (WORDS == "Name")
{
datei1.open("Name.h1", ios::app);
{
cout << "Wer ist das?" << endl;
cin >> ENTRE;
datei1 <<"\n" << ENTRE << "\n " << endl;
}
}
datei1 << ENTRE << endl;
datei2 << ENTRE << endl;
}
}
}
}
{
NEXT2:
cout << ".";
}
}
}
-
March 7th, 2012, 04:38 PM
#8
Re: Help definition
Please delete the word 'goto' from your code AND from your memory. Using 'goto' is asking for trouble, and totally unnecessary.
-
March 7th, 2012, 04:41 PM
#9
Re: Help definition
Enclosing everything in blocks like that is kind of odd and unnecessary too.
-
March 8th, 2012, 03:11 AM
#10
Re: Help definition
What do you mean? Could you show it me?
Sincerley
BUT what I want:
Entre a word, it checks if it's still there.
If not, it will save the word and it's definition.
I need:
If I entre a word, the PC must entre me the other word back.
???????????????
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|