Initial commit

This commit is contained in:
studavrije7683
2021-10-15 08:36:02 +02:00
commit d3138a4b13
89 changed files with 2898 additions and 0 deletions
@@ -0,0 +1,22 @@
#include <iostream>
using namespace std;
int main()
{
int Tiernummer[50];
for(int i=0; i<50; i++)
{
Tiernummer[i]=i+1; // im ersten Feldindex Tiernummer[0] wird z.B. dieZahl 1 abgelegt.
}
for(int i=0; i<50; i++)
{
cout << "Tiernummer[" << i << "]: " << Tiernummer[i] << endl; // im ersten Feldindex Tiernummer[0] wird z.B. dieZahl 1 abgelegt.
}
system("Pause");
}
@@ -0,0 +1,35 @@
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
float celsius[10];
float fahrenheit;
float tmp;
int schrittweite = 10;
int i = 0;
cout << "Fahrenheit: ";
cin >> fahrenheit;
tmp = fahrenheit;
cout << endl;
for(i = 0; i < 10; i++)
{
celsius[i] = ((fahrenheit - 32) * 5) / 9;
fahrenheit += schrittweite;
}
i = 0;
fahrenheit = tmp;
while(i < 10)
{
cout << "Fahrenheit: " << fahrenheit << "\t| Celsius[" << i << "]: " << celsius[i] << endl;
fahrenheit += schrittweite;
i++;
}
return 0;
}
@@ -0,0 +1,45 @@
#include <iostream>
#include <cstdlib>
using namespace std;
void sortiere(string[], int);
int main()
{
int anzahl = 5;
string namen[anzahl];
cout << "Bitte geben Sie 5 Namen ein:" << endl;
int i = 0;
for (i = 0; i < 5; i++)
{
cout << "Name " << i+1 << ": ";
cin >> namen[i];
}
cout << "...... AUSGABE IN ALPHABETISCHER REIHENFOLGE ......" << endl;
sortiere(namen, anzahl);
system("PAUSE");
return 0;
}
void sortiere(string namen[], int size)
{
string tmp_name = "";
for (int i = 0; i < size - 1; i++)
{
for (int j = i+1; j < size; j++)
{
if (namen[i] > namen[j]) {
tmp_name = namen[i];
namen[i] = namen[j];
namen[j] = tmp_name;
}
}
}
for (int k = 0; k < size; k++)
{
cout << namen[k] << endl;
}
}
@@ -0,0 +1,46 @@
#include <iostream>
#include <cstdlib>
using namespace std ;
int main ()
{
int a [10] , i , zw , change ;
cout << "unsortiert: ";
for ( i =0; i <10; i ++)
{
a [i] = rand()%100;
cout << a [i] << " ";
}
// sortieren ( und dabei ausgeben ...)
do
{
cout << endl << "Zwischenschritt: ";
change=0; // keine Vertauschung noetig
for (i=0; i<9; i++)
if ( a [i] > a [i+1])
{
zw = a[i];
a[i] = a[i+1];
a[i+1] = zw;
change = 1; // Vertauschung
}
for (i=0; i<10; i++) cout << a [i] << " ";
}
while (change);
cout << endl;
cout << "sortiert: ";
for ( i =0; i <10; i ++)
{
cout << a [i] << " ";
}
cout << endl;
system("pause");
return 0;
}