neu initialisiert

This commit is contained in:
Leaced 2017-04-08 17:51:54 +02:00
parent 439c84c079
commit ef8bdb0399
5 changed files with 22 additions and 43 deletions

View file

@ -7,7 +7,7 @@
int main() int main()
{ {
long double height, weight; long double height = 0, weight = 0;
std::string input; std::string input;
std::cout<<"Gib deine Gr\x94\xE1 \be in metern ein: "; std::cout<<"Gib deine Gr\x94\xE1 \be in metern ein: ";

View file

@ -8,7 +8,7 @@
int main() int main()
{ {
std::string input; std::string input;
long double speed, distance, speedOppositeTrack, position; long double speed = 0, distance = 0, speedOppositeTrack = 0, position = 0;
std::cout << "Gib die Strecke der Landstra\xE1 \be in km ein: "; std::cout << "Gib die Strecke der Landstra\xE1 \be in km ein: ";
do do

View file

@ -1,89 +1,68 @@
#include<iostream> #include<iostream>
#include<string> #include<string>
#include<sstream> #include<sstream>
#include<conio.h>
int main() int main()
{ {
long long depth = 1; long long depth = 1;
std::string input; std::string input;
std::cout << "Geben sie die Tiefe ein: "; std::cout << "Gib die Tiefe ein: ";
do do
{ {
getline(std::cin, input); getline(std::cin, input);
std::stringstream(input) >> depth; std::stringstream(input) >> depth;
if(depth<2)std::cout << "ERROR: Die Zahl muss gr\x94\xE1 \ber als 1 sein. Geben sie die Tiefe erneut ein: "; if(depth<2)std::cout << "ERROR: Die Zahl muss gr\x94\xE1 \ber als 1 sein. Gib die Tiefe erneut ein: ";
}while(depth<2); }while(depth<2);
for(long long idx = 0; idx<depth*depth; idx++) for(long long idx = 0; idx<depth*depth; idx++)
{ {
if(idx%depth==0) std::cout << "\n"; if(idx%depth==0) std::cout << "\n";
std::cout << "*"; std::cout << "*";
} }
std::cout << "\n"; std::cout << "\n";
for(long long idx = 0; idx<depth; idx++) for(long long idx = 0; idx<depth; idx++)
{ {
std::cout << "\n"; std::cout << "\n";
for(long long idx2 = 0; idx2<idx; idx2++) for(long long idx2 = 0; idx2<idx; idx2++) std::cout << " ";
{ for(long long idx2 = 0; idx2<depth*2-1-2*idx; idx2++) std::cout << "*";
std::cout << " ";
}
for(long long idx2 = 0; idx2<depth*2-1-2*idx; idx2++)
{
std::cout << "*";
}
} }
std::cout << "\n\n"; std::cout << "\n\n";
for(long long idx = 0; idx<depth-1; idx++) for(long long idx = 0; idx<depth-1; idx++)
{ {
for(long long idx2 = 0; idx2<depth-idx-1; idx2++) for(long long idx2 = 0; idx2<depth-idx-1; idx2++) std::cout << " ";
{
std::cout << " ";
}
std::cout << "*"; std::cout << "*";
for(long long idx2 = 0; idx2<2*idx-1; idx2++) for(long long idx2 = 0; idx2<2*idx-1; idx2++) std::cout << " ";
{
std::cout << " ";
}
if(idx>0) std::cout << "*"; if(idx>0) std::cout << "*";
std::cout << "\n"; std::cout << "\n";
} }
for(long long idx = 0; idx<2*depth-1; idx++) std::cout << "*";
for(long long idx = 0; idx<2*depth-1; idx++)
{
std::cout << "*";
}
for(long long idx = 0; idx<depth-2; idx++) for(long long idx = 0; idx<depth-2; idx++)
{ {
std::cout << "\n*"; std::cout << "\n*";
for(long long idx2 = 0; idx2<2*depth-3; idx2++) for(long long idx2 = 0; idx2<2*depth-3; idx2++) std::cout << " ";
{
std::cout << " ";
}
std::cout << "*"; std::cout << "*";
} }
std::cout << "\n"; std::cout << "\n";
for(long long idx = 0; idx<2*depth-1; idx++) std::cout << "*";
for(long long idx = 0; idx<2*depth-1; idx++) std::cout << "\n\n\nProgrammende!";
{ getch();
std::cout << "*";
}
std::cout << "\n\n\n\nProgrammende!";
getchar();
return(0); return(0);
} }

View file

@ -6,7 +6,7 @@
int main() int main()
{ {
std::string input; std::string input;
unsigned short amount; unsigned short amount = 1;
std::cout << "Gib die Anzahl der Zahlen ein: "; std::cout << "Gib die Anzahl der Zahlen ein: ";
getline(std::cin, input); getline(std::cin, input);

View file

@ -6,9 +6,9 @@
int main() int main()
{ {
std::string input; std::string input;
unsigned short amount; unsigned short amount = 1;
std::cout << "Gib die Anzahl der zahlen ein: "; std::cout << "Gib die Anzahl der Zahlen ein: ";
getline(std::cin, input); getline(std::cin, input);
std::stringstream(input) >> amount; std::stringstream(input) >> amount;