Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Array.c
- Autor: Rabus Dominik
- Version: 0.1
- Datum: 22.10.2018
- Änderungen:
- */
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #define AE (unsigned char)142
- #define ae (unsigned char)132
- #define OE (unsigned char)153
- #define oe (unsigned char)148
- #define UE (unsigned char)154
- #define ue (unsigned char)129
- int main()
- {
- char startstring[5] = "start";
- char eingabestring[5] = "nicht";
- /*
- do{
- printf("Bitte geben Sie start ein um das Programm zu starten: \n");//Check for Start parameter
- gets (eingabestring);
- printf("Deine Eingabe war %s \n",eingabestring);
- if (strcmp(eingabestring,startstring) == 0){
- printf("Du kannst nun mit Enter fortfahren, Danke \n");
- }
- }while (strcmp (eingabestring, startstring) != 0);
- */
- void print_3D_Array(int x, int y, int z, int arr[x][y][z]) //Function for printing 3D Arrays
- {
- for (int i = 0; i < x; i++)
- {
- for (int j = 0; j < y; j++)
- {
- for (int k = 0; j < z; k++)
- {
- printf("%d\t", arr[i][j][k]);
- }
- printf("\n");
- }
- printf("\n");
- }
- }
- int dimension1;
- int dimension2;
- int dimension3;
- printf("W%chlen Sie die Gr%csse des Arrays: \n", 132, 148); //Userinput for Size from Arrays
- int check2ndnumber = scanf("%d"
- "%d"
- "%d",
- &dimension1, &dimension2, &dimension3);
- if (check2ndnumber = !3)
- {
- printf("Fehler, das ist kein Operator... \n");
- return 1;
- }
- int arrayd[dimension1][dimension2][dimension3]; //3D Array
- int counter = 1;
- //Write the Array
- for (int c = 0; c < dimension1; c++)
- {
- for (int d = 0; d < dimension2; d++)
- {
- for (int e = 0; e < dimension3; e++)
- {
- arrayd[c][d][e] = counter;
- counter++;
- }
- }
- }
- print_3D_Array(dimension1, dimension2, dimension3, arrayd);
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement