0

Need help

#include <iostream> using namespace std; void sav(int x){ if(x==0){ cout<<" saving account opened successfully "<<endl;} if(x==1){ cout<<" salary account opened successfully "<<endl; } cout<<"date march 2020"<<endl; } int s(int x){ int save,sum=x; save=2*x/100; sum=sum+save; return sum; } int month(int p){ for(int x=3;x<=8;x++) { x+=1; x++; return x; }} int main() { int a,b,num1,num2,d; cout<<"enter 0 to open saving account "<<endl; cin>>a; cout<<"enter 1 to open salary account "<<endl; cin>>b; sav(a); sav(b); cout<<"enter money for saving account "<<endl; cin>>num1; cout<<"enter money in salary account "<<endl; cin>>num2; cout<<"after 1 month saving account money with profit "<<s(num1)<<endl; cout<<"after one month money in salary account"<<num2<<endl; cout<<"month no "<<endl; cin>>d; cout<<month(d); return 0; }

8th Dec 2020, 4:07 AM
Anas kayani
Anas kayani - avatar
16 Antworten
+ 2
Anas kayani You can use loop int sum = 0; for (int i = 0; i < month; i++) { sum = sum + 2 * savingAmount / 100; }
8th Dec 2020, 4:40 AM
A͢J
A͢J - avatar
+ 1
Write a program in which user opens a savings account and a salary account in third month of the year 2020.the user should be able to deposit a specific amount in both of these accounts .the saving account adds an interest of two percent per month .the program should be able to display amount of money in both these accounts for 5 months after date of opening.
8th Dec 2020, 5:09 AM
Anas kayani
Anas kayani - avatar
0
I want to input month and user calculate 5 months money with 2% profit each month
8th Dec 2020, 4:12 AM
Anas kayani
Anas kayani - avatar
0
Should i use loop for finding next 5 months money with 2% profit each month Or Switch statement s Or What
8th Dec 2020, 4:14 AM
Anas kayani
Anas kayani - avatar
0
No
8th Dec 2020, 4:34 AM
Anas kayani
Anas kayani - avatar
0
I have to input 0 1 to open account Then i have to store money in both accounts
8th Dec 2020, 4:35 AM
Anas kayani
Anas kayani - avatar
0
One is salary account other is saving account
8th Dec 2020, 4:35 AM
Anas kayani
Anas kayani - avatar
0
Saving account will show profit of 2% every month I have to show the money along with profit for next 5 months
8th Dec 2020, 4:37 AM
Anas kayani
Anas kayani - avatar
0
Actually loop runs for only first month
8th Dec 2020, 4:47 AM
Anas kayani
Anas kayani - avatar
0
Anas kayani No if you only take 1 as input then only first month. Enter 5 or 6 and then check.
8th Dec 2020, 4:56 AM
A͢J
A͢J - avatar
0
Ca you please send me the correct code that proceeds for 5 months
8th Dec 2020, 4:58 AM
Anas kayani
Anas kayani - avatar
0
I am unable to do that
8th Dec 2020, 4:59 AM
Anas kayani
Anas kayani - avatar
0
Anas kayani Can you post your actual problem? So I can check what we need.
8th Dec 2020, 5:02 AM
A͢J
A͢J - avatar
0
?
8th Dec 2020, 5:19 AM
Anas kayani
Anas kayani - avatar
- 1
Anas kayani Do you want to take only month as input?
8th Dec 2020, 4:34 AM
A͢J
A͢J - avatar
8th Dec 2020, 3:47 PM
A͢J
A͢J - avatar