Help definition
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: Help definition

  1. #1
    Join Date
    Mar 2012
    Posts
    4

    Wink 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 01:56 PM.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,068

    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.

  3. #3
    Join Date
    Mar 2012
    Posts
    4

    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

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,068

    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

  5. #5
    Join Date
    Jan 2012
    Posts
    33

    Re: Help definition

    [ c o d e ] "code" [ / c o d e ]

    Code:
    Will make code look like this

  6. #6
    Join Date
    Mar 2012
    Posts
    4

    Re: Help definition

    Thanks

  7. #7
    Join Date
    Jan 2012
    Posts
    33

    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 << "."; 
    		}
    	}
    }

  8. #8
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Help definition

    Please delete the word 'goto' from your code AND from your memory. Using 'goto' is asking for trouble, and totally unnecessary.

  9. #9
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,068

    Re: Help definition

    Enclosing everything in blocks like that is kind of odd and unnecessary too.

  10. #10
    Join Date
    Mar 2012
    Posts
    4

    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center