Skip to content

Commit

Permalink
Merge pull request #65 from Makasimchik/Task5
Browse files Browse the repository at this point in the history
home_work(Titaev)
  • Loading branch information
lordoz234 authored Dec 19, 2023
2 parents 83aba13 + e8567df commit c2898fb
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions Task5/Task5/TitaevTask5.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# include <stdio.h>
# include <math.h>
# include <stdlib.h>
# include <locale.h>
int main() {
setlocale(LC_ALL, "RU");
int products[9] = { 1001, 2002, 3003, 4004, 5005, 6006, 7007, 8008, 9009 };
printf("Øòðèõ êîä òîâàðîâ: "); printf("ôóòáîëêà - "); printf("%d", products[0]); printf("\n");
printf("Øòðèõ êîä òîâàðîâ: "); printf("êåïêà - "); printf("%d", products[1]); printf("\n");
printf("Øòðèõ êîä òîâàðîâ: "); printf("øàïêà - "); printf("%d", products[2]); printf("\n");
printf("Øòðèõ êîä òîâàðîâ: "); printf("êóðòêà - "); printf("%d", products[3]); printf("\n");
printf("Øòðèõ êîä òîâàðîâ: "); printf("âåòðîâêà - "); printf("%d", products[4]); printf("\n");
printf("Øòðèõ êîä òîâàðîâ: "); printf("ñâèòøîò - "); printf("%d", products[5]); printf("\n");
printf("Øòðèõ êîä òîâàðîâ: "); printf("ñïîðòèâíûå øòàíû - "); printf("%d", products[6]); printf("\n");
printf("Øòðèõ êîä òîâàðîâ: "); printf("äæèíñû - "); printf("%d", products[7]); printf("\n");
printf("Øòðèõ êîä òîâàðîâ: "); printf("îáóâü - "); printf("%d", products[8]); printf("\n");
// ñêàíèðîâàíèå øòðèõ êîäà
int price[9] = { 700, 400, 500, 10000, 6000, 4000, 5500, 7000, 9900 };
char array[][9] = { "t_shirt", "cap", "hat", "jacket", "kyrtka", "sweatshot", "sportpant", "jeans","shoes" };
int basket[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int q = 1;
int shtr = 0;
int kol_tov = 0;
while (q != 0) {
printf("Ââåäèòå øòðèõ êîä òîâàðà ");
scanf_s("%d", &shtr);
kol_tov++;
int i = 0;
while (products[i] != shtr) {
i++;
}
i++;
basket[i] = +1;
printf("Åñëè âû õîòèòå ïîëîæèòü â êîðçèíó ÷òî-òî åùå, âïèøèòå 1 ");
scanf_s("%d", &q);
};
for (int i = 0; i < 10; i++) {
if (i == 0) {
printf("ÂÀØ ÈÒÎÃÎÂÛÉ ×ÅÊ ËÈÑÒ.");
};
if (basket[i] != 0) {
int sale = 0;
float p = price[i] * basket[i];
printf("\n"); printf(products[i]); printf(" òîâàð ñ íàçâàíèåì: "); printf(array[i]); printf("  êîëè÷åñòâå: "); printf(basket[i]);
};

};
int sale = 0;
printf("Ââåäèòå ðàçìåð ñêèäêè ");
scanf_s("%d", &sale);
float p = (basket[1] * price[1] + basket[2] * price[2] + basket[3] * price[3] + basket[4] * price[4] + basket[5] * price[5] + basket[6] * price[6] + basket[7] * price[7] + basket[8] * price[8] + basket[9] * price[9] + basket[0] * price[0]) * (1 - (sale / 100));
printf(" Èòîãîâàÿ ñóììà òîâàðà â âàøåì ÷åêå ñîñòàâëÿåò: "); printf("%d", p);
return 0;
}

0 comments on commit c2898fb

Please sign in to comment.