Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char cristo[20] = "";
- int type = 0;
- char stringa[10] = "stringa";
- char valore[10]= "valore";
- int i = 0;
- int len = 0;
- char flag[10] = "";
- char flag2[10] = "";
- int j = 0;
- char flag3[10] = "";
- char flag4[10] = "";
- char fra[10] = "fra";
- char nonfra[10] = "nonfra";
- int lenvalore = 0;
- int lenstringa = 0;
- int lenfra = 0;
- int lennonfra = 0;
- printf ("########################################################\n");
- printf ("# #\n");
- printf ("# Programma per Fra <3 #\n");
- printf ("# #\n");
- printf ("# </> - By claxon007 - </> #\n");
- printf ("# #\n");
- printf ("########################################################\n");
- printf ("# #\n");
- printf ("# - Digita '1' per inserire un valore. #\n");
- printf ("# - Digita '2' per fare il clear della schermata. #\n");
- printf ("# - Digita '3' per ricominciare. #\n");
- printf ("# - Digita '4' per uscire. #\n");
- printf ("# #\n");
- printf ("########################################################\n");
- printf ("\n");
- printf ("Inserisci il tuo valore: ");
- scanf ("%d", &type);
- switch (type)
- {
- case (1):
- printf ("Vuoi inserire una stringa o un valore? Digita 'stringa' o 'valore' per scegliere: ");
- gets (cristo);
- len = strlen(cristo);
- lenvalore = strlen (valore);
- lenstringa = strlen (stringa);
- if (len == lenvalore)
- {
- j = 0;
- for (i = 0; i < len; i++)
- {
- if (cristo[i] == valore[i])
- {
- flag[j] = 'a';
- j++;
- }
- else
- {
- flag[j] = 'b';
- j++;
- }
- }
- }
- else
- {
- j = 0;
- if (len == lenstringa)
- {
- for (i = 0; i < len; i++)
- {
- if (cristo[i] == stringa[i])
- {
- flag2[j] = 'a';
- j++;
- }
- else
- {
- flag2[j] = 'b';
- j++;
- }
- }
- }
- else
- {
- printf ("ERRORE1");
- }
- }
- if (len == lenvalore)
- {
- for (i = 0; i < len; i++)
- {
- if (flag[i] = 'b')
- {
- printf ("ERRORE2");
- }
- else
- {
- printf ("Inserisci 'fra' per far felice cla o inserisci 'nonfra' per far triste cla: ");
- gets (cristo);
- len = strlen(cristo);
- lenfra = strlen (fra);
- lennonfra = strlen (nonfra);
- if (len == lenfra)
- {
- j = 0;
- for (i = 0; i < len; i++)
- {
- if (cristo[i] == fra[i])
- {
- flag3[j] = 'a';
- j++;
- }
- else
- {
- flag3[j] = 'b';
- j++;
- }
- }
- }
- else
- {
- j = 0;
- if (len == lennonfra)
- {
- for (i = 0; i < len; i++)
- {
- if (cristo[i] == nonfra[i])
- {
- flag4[j] = 'a';
- j++;
- }
- else
- {
- flag4[j] = 'b';
- j++;
- }
- }
- }
- else
- {
- printf ("ERRORE3");
- }
- }
- }
- }
- }
- else
- {
- if (flag2[i] = 'b')
- {
- printf ("ERRORE4");
- }
- else
- {
- printf ("PROGRAMMA");
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement