C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

probs mit nem einfachen program

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German)
View previous topic :: View next topic  
Author Message
Claus Nietzsche
Guest





PostPosted: Thu Dec 25, 2003 2:34 pm    Post subject: probs mit nem einfachen program Reply with quote



hey ng,
ich hab dieses program geschrieben, bekomm aber immer beim compilen ne
fehlermeldung in folgender zeile:
void DoDrawRect(Rectangle);


#include <iostream>
using namespace std;

enum choice { DrawRect = 1, GetArea, GetPerim, ChangeDimensions, Quit};

class Rectangle
{
public:
Rectangle(int width, int height);
~Rectangle();

int GetWidth() {return itsWidth;}
int GetHeight() {return itsHeight;}
int GetArea() {return (itsWidth*itsHeight);}
int GetPerim() {return (2*itsWidth+2*itsHeight);}
void SetSize(int width, int height);

private:
int itsWidth;
int itsHeight;
};

Rectangle::Rectangle(int width, int height)
{
itsWidth=width;
itsHeight=height;
}

Rectangle::~Rectangle() {}

void Rectangle::SetSize(int width, int height)
{
itsWidth=width;
itsHeight=height;
}

int DoMenu();
void DoDrawRect(Rectangle); // <<--DAS PROBLEM!!!!!
void DoGetArea(Rectangle);
void DoGetPerim(Rectangle);

int main()
{
Rectangle theRect(30,5);

int choice=DrawRect;
int fQuit=false;

while(!fQuit)
{
choice=DoMenu();
if (choice {
cout << "nAuswahl ungueltig. Bitte neu versuchen.nn";
continue;
}
switch(choice)
{
case DrawRect:
DoDrawRect(theRect);
break;
case GetArea:
DoGetArea(theRect);
break;
case GetPerim:
DoGetPerim(theRect);
break;
case ChangeDimensions:
int newWidth, newHeight;
cout << "nBitte geben Sie die Breite an: ";
cin << newWidth;
cout << "nBitte geben Sie die Hoehe an: ";
cin << newHeight;
theRect.SetSize(newWidth, newHeight);
DoDrawRect(theRect);
break;
case Quit:
fQuit=true;
cout << "nVerlassen.n";
break;
default:
cout << "nFehler beim Auswaehlen!n";
fQuit=true;
break;
}
return 0;
}

int DoMenu()
{
int choice;
cout << "nn**** Menue ****n";
cout << "(1) Rechteck zeichnenn";
cout << "(2) Flaechen";
cout << "(3) Umfangn";
cout << "(4) Groesse veraendernn";
cout << "(5) Beendenn";

cin >> choice;
return choice;
}

void DoDrawRect(Rectangle theRect)
{
int height=theRect.GetHeight();
int width=theRect.GetWidth();
for(int i=0; i {
for(int j=0; j cout << "x";
cout << endl;
}
}

void DoGetArea(Rectangle theRect)
{
int area=theRect.GetArea();
cout << "Flaeche: " << area << endl;
}

void DoGetPerim(Rectangle theRect)
{
int perim=theRect.GetPerim();
cout << "Umfang: " << perim << endl;
}

waere dankbar fuer jede hilfe!!!
bis dann,
Claus

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
Back to top
Thomas Maeder
Guest





PostPosted: Fri Dec 26, 2003 4:33 pm    Post subject: Re: probs mit nem einfachen program Reply with quote



"Claus Nietzsche" <claus.n (AT) hotmail (DOT) com> writes:

Quote:
ich hab dieses program geschrieben, bekomm aber immer beim compilen ne
fehlermeldung in folgender zeile:
void DoDrawRect(Rectangle);

Bitte reduziere dieses Programm auf die absolut minimale Länge, welche
den Compiler veranlasst, diese Fehlermeldung auszugeben. Poste dann das
resultierende Programm und die Fehlermeldung - kopieren und einfügen, bitte,
nicht abtippen.

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Marco Budde
Guest





PostPosted: Fri Dec 26, 2003 4:57 pm    Post subject: Re: probs mit nem einfachen program Reply with quote



Claus Nietzsche wrote:

Quote:
ich hab dieses program geschrieben, bekomm aber immer beim compilen ne
fehlermeldung

Bitte nicht soviele Fakten, es soll ja noch was für die Kristallkugel
überbleiben.

Quote:
in folgender zeile:
void DoDrawRect(Rectangle);

Nö:

-------------------------------------------------------------------
bash-2.03$ g++ 1.cpp
1.cpp: In function `int main()':
1.cpp:72: error: no match for 'operator<<' in 'std::cin << newWidth'
1.cpp:74: error: no match for 'operator<<' in 'std::cin << newHeight'
1.cpp:91: error: syntax error before `{' token
-------------------------------------------------------------------

Statt hier komplette Programme zu posten, versuche beim nächsten Mal
bitte, das Listing auf das Problem direkt zu reduzieren.

Bei den ersten beiden Problemen würde ich mir mal in einem Buch den
Syntax von "cin" anschauen, bei dem letzten Fehler würde ich mal
schauen, ob Du alle Blöcke korrekt beendet hast.

Quote:
waere dankbar fuer jede hilfe!!!

Dann tu uns bitte einen Gefallen und benutze beim nächsten Mal Deine
Shifttaste.

cu, Marco
--
S: Minolta: Winkelsucher (VN), VC-9

E-Mail: mb-news-b<ät>linuxhaven.de
Deutsches Linux HOWTO Projekt: http://www.linuxhaven.de

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Wolfgang Kaufmann
Guest





PostPosted: Fri Dec 26, 2003 5:26 pm    Post subject: Re: probs mit nem einfachen program Reply with quote

* Thus spoke Claus Nietzsche <claus.n (AT) hotmail (DOT) com>:

Hallo,

Quote:
ich hab dieses program geschrieben, bekomm aber immer beim compilen ne
fehlermeldung in folgender zeile:
void DoDrawRect(Rectangle);

Mehr nicht? Da es Dir scheinbar ohnehin lediglich um Fehlerhinweise und
nicht um weitere Kommentare zum Code geht, hier bitte:

Quote:
while(!fQuit)
{
choice=DoMenu();
if (choice<DrawRect || choice>Quit)
{
cout << "nAuswahl ungueltig. Bitte neu versuchen.nn";
continue;
}
switch(choice)
{
[...]
case ChangeDimensions:
int newWidth, newHeight;
cout << "nBitte geben Sie die Breite an: ";
cin << newWidth;
cin >> newWidth;
cout << "nBitte geben Sie die Hoehe an: ";
cin << newHeight;
cin >> newHeight;

[...]
Quote:
}
return 0;
}
}

Wolfgang.
--
"Erfahrungen -- das sind die vernarbten Wunden unserer Dummheit."
-- John Osborne

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Rolf Magnus
Guest





PostPosted: Fri Dec 26, 2003 7:12 pm    Post subject: Re: probs mit nem einfachen program Reply with quote

Claus Nietzsche wrote:

Quote:
hey ng,
ich hab dieses program geschrieben, bekomm aber immer beim compilen ne
fehlermeldung in folgender zeile:

Und was für "ne fehlermeldung" wäre das?

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Rolf Magnus
Guest





PostPosted: Sun Dec 28, 2003 10:07 am    Post subject: Re: probs mit nem einfachen program Reply with quote

Marco Budde wrote:

Quote:
Statt hier komplette Programme zu posten, versuche beim nächsten Mal
bitte, das Listing auf das Problem direkt zu reduzieren.

Es ist hier eigentlich schon eher erwünscht, komplette Programme (also
inclusive main() und bis auf den beobachteten Fehler compilierbar) zu
posten, allerdings sollten diese auf ein minimales Beispiel reduziert
sein, das den Fehler noch zeigt.

--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.