/*
Copyright (C) 2010 Alessandro Bugatti (alessandro.bugatti@istruzione.it)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*! \file
* \brief
* \author Alessandro Bugatti - Matteo Busi
*
* \version 0.1
* \date Creazione 22/10/2009
* \date Ultima modifica 21/10/2013
*
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int again = 1, rx, tot=0;
//Var domande
int cell_0=0, cell_1=0, cell_2=0;
int mp3_0=0, mp3_1=0, mp3_2=0;
int netbook_0=0, netbook_1=0, netbook_2=0;
printf("Gestione di sondaggi telefoni per un operatore di call center\n");
do
{
printf("Vuole partecipare?\n1) Sì\n2) No\n");
scanf("%d", &rx);
tot++;
if (rx == 1)
{
printf("Ha un cellulare?\n0) Nessun cellulare\n1) Un cellulare\n2) Più di uno\n");
scanf("%d", &rx);
if (rx == 0) cell_0++;
else if (rx == 1) cell_1++;
else if (rx == 2) cell_2++;
printf("Ha un lettore MP3?\n0) Nessun lettore\n1) Un lettore\n2) Più di uno\n");
scanf("%d", &rx);
if (rx == 0) mp3_0++;
else if (rx == 1) mp3_1++;
else if (rx == 2) mp3_2++;
printf("Ha un netbook?\n0) Nessun netbook\n1) Un netbook\n2) Più di uno\n");
scanf("%d", &rx);
if (rx == 0) netbook_0++;
else if (rx == 1) netbook_1++;
else if (rx == 2) netbook_2++;
}
printf("Vuoi eseguire di nuovo il questionario?(1 = si, -1 = no)\n");
scanf("%d", &again);
}
while (again != -1);
printf("Hai effettuato %d chiamate, %d hanno risposto\n", tot, cell_0+cell_1+cell_2);
if (cell_0+cell_1+cell_2 != 0)
{
printf("Il %d %% ha 0 cellulari\nIl %d %% ha 1 cellulare\nIl %d %% ha piu' di un cellulare\n", (cell_0*100)/(cell_0+cell_1+cell_2), (cell_1*100)/(cell_0+cell_1+cell_2), (cell_2*100)/(cell_0+cell_1+cell_2));
printf("Il %d %% ha 0 lettori mp3\nIl %d %% ha 1 lettore mp3\nIl %d %% ha piu' di un lettore mp3\n", (mp3_0*100)/(mp3_0+mp3_1+mp3_2), (mp3_1*100)/(mp3_0+mp3_1+mp3_2), (mp3_2*100)/(mp3_0+mp3_1+mp3_2));
printf("Il %d %% ha 0 netbook\nIl %d %% ha 1 netbook\nIl %d %% ha piu' di un netbook\n", (netbook_0*100)/(netbook_0+netbook_1+netbook_2), (netbook_1*100)/(netbook_0+netbook_1+netbook_2), (netbook_2*100)/(netbook_0+netbook_1+netbook_2));
}
return 0;
}