Hi!
Also ich mache ne Ausbildung zum ITA und da haben wir natürlich auch Programmieren. Wir arbeiten im Moment mit Borland C++ und erstellen Konsolenprogramme.
Nun haben wir heute die Aufgabe bekommen ein Programm zu optimieren. Also ich bin der beste bei uns im Kurs und habe das Muster hier auch geschrieben, aber wie ich das jez noch, mit unserem Wissen, optimieren soll weiß ich nich. Wäre super wenn mir jemand helfen könnte!
#include<iostream.h>
#include<dos.h>
#define ANZ 8
void eingaben(int[]);
void sort(int[]);
void ausgabe(int[]);
int main()
{
int eingabe[ANZ];
char trash;
system("color 02");
cout <<" b "<< endl;
cout <<" b "<< endl;
cout <<" bbb y y "<< endl;
cout <<" b bb yy "<< endl;
cout <<" bbb y "<< endl;
cout <<" EEEEEE y LL "<< endl;
cout <<" EE LL "<< endl;
cout <<" EE gggggg gggggg LL "<< endl;
cout <<" EEEEE gg gg gg gg LL "<< endl;
cout <<" EE gg gg gg gg LL "<< endl;
cout <<" EE gg gg gg gg LL "<< endl;
cout <<" EE gg gg gg gg LL "<< endl;
cout <<" EEEEEE gggggg gggggg LLLLLL "<< endl;
cout <<" gg gg "<< endl;
cout <<" gggggg gggggg "<< endl;
cout << endl;
cout << endl;
cout << endl;
cout << "Bitte geben sie " << ANZ << " Zahlen ihrer Wahl ein:" << endl;
eingaben(eingabe);
sort(eingabe);
cout << endl << "So lauten die von ihnen eingegebenen Zahlen in Reihenfolge:" << endl;
ausgabe(eingabe);
cin >> trash;
}
void eingaben(int eingabe[])
{
int i;
for(i=0;i<ANZ;i++)
{
cin >> eingabe[i];
cout << endl;
}
}
void sort(int eingabe[])
{
int i=0,j,z;
for(;i<ANZ-1;)
{
j=i+1;
while(j<ANZ)
{
if(eingabe[i]<eingabe[j])
;
else
{
z=eingabe[i];
eingabe[i]=eingabe[j];
eingabe[j]=z;
}
j++;
}
i++;
}
}
void ausgabe(int eingabe[])
{
int i;
for(i=0;i<ANZ;i++)
cout << eingabe[i] << endl;
}
THX!
GreeTzzZ
EggL