Article View: be.comp.programming
Article #13713need some help in c++
From: Pawel Bojkowsi
Date: Wed, 13 Jun 2001 01:22
Date: Wed, 13 Jun 2001 01:22
219 lines
5156 bytes
5156 bytes
need some help in c++
Hi! brauche bitte dringend deine hilfe in c++
HI!
i need some help in c++...
i�m looking for a job in an it job.. i find it too.
but the bos of the company will see how good are my c++ knowleg..
it�s not sooooooooo good.
he will test me!
he give me a c++ programm the has many errors.
he will that i modificate this programm that it work..
but i don�t know how to start.
the programm is for a car dealer...
pleas help me!!
and here ist the programm with errors:
#include <iostream.h>
#include <stdlib.h>
#include <conio.h> // f�r getch() und system("cls")
int main()
{
char array[10][256]; // 10 Felder mit jeweils Platz f�r 256 Zeichen
cout << "Willkommen zum Bestellprogramm!\n\nDruecken Sie eine beliebige
Taste, um fortzufahren..." << endl;
while (!kbhit()) // solange kbhit() *nicht* (!) true zur�ckgibt...
{} //macht nichts, ein Schleife ohne Inhalt
system("cls"); // l�scht den Bildschirm,
cout << "Kundendatenerfassung: " << endl;
cout << "Name des Kunden: ";
cin.getline(array[0],256);//Zeigt auf anfang des Feldes 0
cout << "Strasse: ";
cin.getline(array[1],256);//Zeigt auf anfang des Feldes 1
cout << "PLZ: ";
cin.getline(array[2],256);//Zeigt auf anfang des Feldes 2
cout << "Wohnort: ";
cin.getline(array[3],256);//Zeigt auf anfang des Feldes 3
cout << "Telefonnummer: ";
cin.getline(array[4],256);//Zeigt auf anfang des Feldes 4
getch(); // warte auf beliebigen Tastendruck
system("cls");
for (int i=0;i<4;i++) // SCHLEIFE // i = 0 ist i kleiner als 4 i + 1 ist i
gleich oder gr��er als 4 beendet
{
cout << "endl"<<array[i];
}
while (!kbhit()) // solange kbhit() *nicht* (!) true zur�ckgibt...
{} //macht nichts, ein Schleife ohne Inhalt
system("cls"); // l�scht den Bildschirm,
getch(); // wieder Taste vorm beenden (return 0)
return 0;
}
#include
using namespace std;
int NrAutos;
int AutoId[100]; // Identifizierungsnummer
string AutoName[100]; // Name des Fahrzeugs
long AutoPreis[100]; // Preis (tatsaechlicher Preis * 100
// ein Wert von 150 bedeutet also einen
// Preis von 1,50 DM
void Add( int Id, string& Name, long Preis )
{
AutoId[NrAutos] = Id;
AutoName[NrAutos] = Name;
AutoPreis[NrAutos] = Preis;
NrAutos++;
}
void PrintVorrat()
{
int i;
for( i = 0; i < NrAutos; ++i )
cout << AutoId << " " << AutoName << " " << AutoPreis / 100.0 << endl;
}
int main()
{
NrAutos = 0;
Add( 1, "Audi A4", 3900099 );
Add( 2, "Audi A6", 5900099 );
Add( 3, "BMW M3", 7900099 );
Add( 4, "BMW 316", 7900099 );
Add( 5, "BMW 320", 7900099 );
Add( 6, "BMW 316i", 7900099 );
Add( 7, "BMW M5", 7900099 );
Add( 8, "BMW Z3", 7900099 );
Add( 9, "BMW M3i", 7900099 );
Add( 10, "BMW M23", 7900099 );
Add( 11, "BMW M323", 7900099 );
Add( 12, "BMW M324", 7900099 );
Add( 13, "BMW M32d", 7900099 );
Add( 14, "BMW M3f", 7900099 );
Add( 15, "BMW M3h", 7900099 );
Add( 16, "BMW M354", 7900099 );
Add( 17, "BMW M3jf", 7900099 );
Add( 18, "BMW M3jde", 7900099 );
Add( 19, "BMW M3je", 7900099 );
Add( 20, "BMW M3ke", 7900099 );
Add( 21, "BMW M3dh", 7900099 );
PrintVorrat()
}
int WaehleAuto()
{
int Id;
int i;
int Index;
PrintVorrat();
do {
cout << "Bitte w�hlen Sie aus : ";
cin >> Id;
Index = -1;
for( i = 0; i < NrAutos; ++i ) {
if( AutoId == Id ) {
Index = i;
}
}
if( Index == -1 )
cout << "Sie haben keine g�ltige Auswahl getroffen!\n";
} while( Index == -1 );
return Index;
}
int main()
{
int NrVerkauft;
int VerkauftIndex[100];
string Antwort;
....
NrVerkauft = 0;
do {
VerkauftIndex[NrVerkauft] = WaehleAuto();
NrVerkauft++;
cout << "Noch ein Fahrzeug J/N";
cin >> Antwort;
while( Antwort == 'J' || Antwort == 'j' );
}
int main()
{
long Total;
......
cout << "Sie haben ausgewahlt:"
Total = 0;
for( i = 0; i < NrVerkauft; ++i ) {
cout << AutoName[VerkauftIndex] << " "
<< AutoPreis[VerkauftIndex] / 100.0
<< endl;
Total += AutoPreis[VerkauftIndex];
}
cout << "Das macht in Summe " << Total / 100.0;
}
Technical Details
Message-ID:
<9g6f8o$ukc$02$1@news.t-online.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: fcea4,eb263439532ac76d,start X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2001-06-12 18:26:13 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.icl.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail From: "Pawel Bojkowsi" <520091215467-0001@t-online.de> Newsgroups: be.comp.programming Subject: need some help in c++ Date: Wed, 13 Jun 2001 03:22:22 +0200 Organization: T-Online Lines: 224 Message-ID: <9g6f8o$ukc$02$1@news.t-online.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.t-online.com 992395353 02 31372 6FHHS6qXSiHrwH 010613 01:22:33 X-Complaints-To: abuse@t-online.com X-Sender: 520091215467-0001@t-dialin.net X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200