generated from justuser-31/code_projects_template
sync
This commit is contained in:
@@ -0,0 +1 @@
|
||||
STEP1_Basics/*/a.out
|
||||
@@ -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
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
printf("Hello world\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Submodule
+1
Submodule STEP1_Basics/3_Formatting/c_cross_pack added at f9a5352b6e
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user