Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- typedef struct list {
- char cod[20];
- double pret;
- enum{telefon, unitate, tableta}tip;
- struct list *urm;
- }depozit;
- int main()
- {
- depozit *head = NULL;
- char cod[20];
- int opt, ok, i;
- do {
- printf("1. Introducere echipament nou\n");
- printf("2. Afisare lista\n");
- printf("3. Schimbare paritate bit\n");
- printf("4. Iesire\n");
- scanf("%d", &opt);
- switch (opt) {
- case 1:
- do{
- ok = 0;
- printf("Cod: "); scanf("%s", cod);
- if (cod[0] >= '0' && cod[0] <= '9' && cod[1] >= 'a' && cod[1] <= 'z' && cod[2] == '-') {
- for (i = 3; cod[i] != 0; i++)if (cod[i] < '0' || cod[i] > '0') break;
- if (cod[i] == 0) ok = 0;
- }
- } while (ok == 0);
- break;
- case 4: return 0;
- }
- } while (1);
- }
Advertisement
Add Comment
Please, Sign In to add comment