hi i am having a problem with my program. Its basically supposed to calculate this way:
Licence price (per 1 copy) Number of licences
$125____________________5 or less
$100____________________6-10
$75_____________________more than 10
Also posting ($25) and new service fee charge ($200). But i dont know what i did wrong in the code. It keeps printing out the same value for total.
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char choice;
int Client_ID_number[5];
char Client_Company_name[10];
char Client_address[20];
int Number_of_software_licences[3];
char New_subscriber[1];
char Postage_and_handling[1];
char Support_service[1];
int total;
printf (" ****************************************************** ");
printf (" ******[CLIENT LIST PROGRAM by Abhyash Timsina]********** ");
printf (" ********************************************************** ");
printf ("\na. Add a New Client\n");
printf ("b. Manage a Current Client\n");
printf ("c. Exit Program\n\n");
printf ("Enter your choice:- ");
scanf ("%c", &choice);
if ( choice == 'a' )
{
printf ("\nEnter Company Name: ");
scanf ("%s", &Client_Company_name[10]);
printf ("Enter Company Address: ");
scanf ("%s", &Client_address[20]);
printf ("Enter Number of Licences: ");
scanf ("%s", &Number_of_software_licences[3]);
if ( Number_of_software_licences[3] <= 5 )
{
total = 125 * Number_of_software_licences[3];
}
else if ( Number_of_software_licences[3] >= 6 || Number_of_software_licences[3] <= 10 )
{
total = 100 * Number_of_software_licences[3];
}
else if ( Number_of_software_licences[3] > 10 )
{
total = 75 * Number_of_software_licences[3];
}
printf ("Postage & Handling Fee? (y or n): ");
scanf ("%s", &Postage_and_handling[1]);
if ( Postage_and_handling[1] == 'y' )
{
total + 25;
}
else if ( Postage_and_handling[1] == 'n' )
{
total + 0;
}
printf ("Support Service? (y or n): ");
scanf ("%s", &Support_service[1]);
if ( Support_service[1] == 'y' )
{
total + 200;
}
else if ( Support_service[1] == 'n' )
{
total + 0;
}
printf ("The Client (%s) Total Bill is: %d\n\n", &Client_Company_name[10], &total);
}
else if ( choice == 'b' )
{
printf ("Test");
}
else if ( choice == 'c' )
{
return 0;
}
system("PAUSE");
return 0;
}