This commit is contained in:
Павел Родионов
2025-11-13 18:21:23 +07:00
parent e266a25b45
commit 2fca7b75f5
28 changed files with 74 additions and 4 deletions
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+12 -3
View File
@@ -18,20 +18,29 @@ int main() {
exit = x = swt = scan = 1; exit = x = swt = scan = 1;
while(exit){ while(exit){
printf("hours: "); printf("hours: ");
scanf("%d", &h); while(scanf("%d", &h)!=1){
while (getchar() != '\n'); printf("input err\n");
if(getchar() == EOF) return 0;
while (getchar() != '\n') continue;
printf("hours: ");
}
while (getchar() != '\n') continue;
do{ do{
while (getchar() != '\n') continue;
printf("Choose tarif:\n"); printf("Choose tarif:\n");
printf("a) $%.2f/h\tb) $%.2f/h\n",t1,t2); printf("a) $%.2f/h\tb) $%.2f/h\n",t1,t2);
printf("c) $%.2f/h\td) $%.2f/h\n",t3,t4); printf("c) $%.2f/h\td) $%.2f/h\n",t3,t4);
printf("q) exit\nInput: "); printf("q) exit\nInput: ");
sw = getchar(); sw = getchar();
if(getchar() == EOF){return 0;}
while (getchar() != '\n') continue;
switch(sw){ switch(sw){
case 'a': t = t1; swt = 0; break; case 'a': t = t1; swt = 0; break;
case 'b': t = t2; swt = 0; break; case 'b': t = t2; swt = 0; break;
case 'c': t = t3; swt = 0; break; case 'c': t = t3; swt = 0; break;
case 'd': t = t4; swt = 0; break; case 'd': t = t4; swt = 0; break;
case 'q': exit = 0; break; case 'q': exit = 0; break;
default: printf("input err\n");
} }
}while(swt&&exit); }while(swt&&exit);
+61
View File
@@ -0,0 +1,61 @@
#include <stdio.h>
#define t1 8.75
#define t2 9.33
#define t3 10.00
#define t4 11.20
// #define t 10 //zp
#define s 40 //sverh
#define u 1.5 //sverh*
#define n1 0.15 //tax1
#define n2 0.2
#define n3 0.25
#define m1 300 //maxbeftax2
#define m2 150
int main() {
int h,sw,x,swt,exit,scan;
float t,tax,a;
exit = x = swt = scan = 1;
while(exit){
printf("hours: ");
while(scanf("%d", &h)!=1){
printf("input err\n");
if(getchar() == EOF) return 0;
while (getchar() != '\n') continue;
printf("hours: ");
}
while (getchar() != '\n') continue;
do{
while (getchar() != '\n') continue;
printf("Choose tarif:\n");
printf("a) $%.2f/h\tb) $%.2f/h\n",t1,t2);
printf("c) $%.2f/h\td) $%.2f/h\n",t3,t4);
printf("q) exit\nInput: ");
sw = getchar();
if(getchar() == EOF){return 0;}
while (getchar() != '\n') continue;
switch(sw){
case 'a': t = t1; swt = 0; break;
case 'b': t = t2; swt = 0; break;
case 'c': t = t3; swt = 0; break;
case 'd': t = t4; swt = 0; break;
case 'q': exit = 0; break;
default: printf("input err\n");
}
}while(swt&&exit);
if(!swt && exit){
if (h>s){tax = a = (s*t + ((h-s) * (t*u)));}
else(tax = a = h*t);
if (tax>m1)
{
if(tax>m2){tax = (m1*n1) + (m2*n2) + ((tax-m1-m2)*n3);}
else(tax = (m1*n1) + ((tax-m1)*n2));
}
else (tax*=n1);
printf("Acc: %.3f\nTax: %.3f\nReceived: %.3f\n",a,tax,a-tax);
}}
return 0;
}
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
void power(double *x, int *exp, double *xpow, int *i); void power(double *x, int *exp, double *xpow, int *i);
int main(void){ int main(){
double x, xpow; double x, xpow;
int exp, i; int exp, i;
i = 1; i = 1;