hello, i m a newbie in c++..i nid u all to help me..how to share the new_balance with void call() and void sms()?
Code:
#include<stdio.h>
void sms();
void call();
void topup();
void logo();
void main()
{
logo();
}
void logo()
{
printf("[1] Call, [2] SMS, [3] TOP UP, [4] EXIT ? ");
scanf("%d", &choose);
if(choose == 1)
{
printf("\nYou Have Choosen %s\n", "CALL");
call();
}
else
{
}
if(choose == 2)
{
printf("\nYou Have Choosen %s\n", "SMS");
sms();
}
else
{
}
if(choose == 3)
{
printf("\nYou Have Choosen %s\n", "TOP UP");
topup();
}
else
{
}
if(choose == 4)
{
printf("\nYou Have Choosen %s\n", "EXIT");
logo();
}
else
{
}
}
void call()
{
double balance = 10.0, call_duration, new_balance;
printf("The Prepaid Balance = %.2lf\n", balance);
printf("Call Duration(minutes) : ");
scanf("%f", &call_duration);
new_balance = balance - (call_duration * 0.50);
printf("Your new balance = %.2lf", new_balance);
}
void sms()
printf("The Prepaid Balance = %.2lf\n", new_balance);
Comment