generated from justuser-31/code_projects_template
sync
This commit is contained in:
parent
b033d316e8
commit
9b912d396c
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
STEP1_Basics/*/a.out
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "STEP1_Basics/3_Formatting/c_cross_pack"]
|
||||
path = STEP1_Basics/3_Formatting/c_cross_pack
|
||||
url = ssh://git@git.del.pw:2222/justuser-31/c_cross_pack.git
|
7
STEP1_Basics/1_Hello_world/main.c
Normal file
7
STEP1_Basics/1_Hello_world/main.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("Hello world\n");
|
||||
|
||||
return 0;
|
||||
}
|
26
STEP1_Basics/2_Arithmetic/main.c
Normal file
26
STEP1_Basics/2_Arithmetic/main.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
int main() {
|
||||
float x, y;
|
||||
printf("Enter x: "); scanf("%f", &x);
|
||||
printf("Enter y: "); scanf("%f", &y);
|
||||
|
||||
float sum = x + y;
|
||||
float sub = x - y;
|
||||
float mult = x * y;
|
||||
float div = x / y;
|
||||
float poww = pow(x, y);
|
||||
float sqrtt = pow(x, (1/y));
|
||||
|
||||
printf("Results:\n"
|
||||
"sum: %f\n"
|
||||
"sub: %f\n"
|
||||
"mult: %f\n"
|
||||
"div: %f\n"
|
||||
"pow: %f\n"
|
||||
"sqrt: %f\n",
|
||||
sum, sub, mult, div, poww, sqrtt);
|
||||
|
||||
return 0;
|
||||
}
|
1
STEP1_Basics/3_Formatting/c_cross_pack
Submodule
1
STEP1_Basics/3_Formatting/c_cross_pack
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit f9a5352b6e6752375cd3520b28da474285288768
|
35
STEP1_Basics/3_Formatting/main.c
Normal file
35
STEP1_Basics/3_Formatting/main.c
Normal file
@ -0,0 +1,35 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "c_cross_pack/libs/string.h"
|
||||
|
||||
int main() {
|
||||
int day, year;
|
||||
string month = strInit("");
|
||||
|
||||
printf("Enter day of month: "); scanf("%d", &day);
|
||||
printf("Enter month name: "); scanf("%s", month);
|
||||
printf("Enter year: "); scanf("%d", &year);
|
||||
|
||||
string yyyy_mm_dd = strInit(int2Str(&year));
|
||||
strAdd(&yyyy_mm_dd, "-");
|
||||
strAdd(&yyyy_mm_dd, month);
|
||||
strAdd(&yyyy_mm_dd, "-");
|
||||
strAdd(&yyyy_mm_dd, int2Str(&day));
|
||||
|
||||
string dd_mm_yyyy = strInit(int2Str(&day));
|
||||
strAdd(&dd_mm_yyyy, "-");
|
||||
strAdd(&dd_mm_yyyy, month);
|
||||
strAdd(&dd_mm_yyyy, "-");
|
||||
strAdd(&dd_mm_yyyy, int2Str(&year));
|
||||
|
||||
printf("\nResult:\n");
|
||||
printf("yyyy_mm_dd: %s\n", yyyy_mm_dd);
|
||||
printf("dd_mm_yyyy: %s\n", yyyy_mm_dd);
|
||||
|
||||
free(month);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user