-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
51 lines (46 loc) · 1.65 KB
/
main.cpp
File metadata and controls
51 lines (46 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//This code contains the main flow of the application with function calls and flow logic.
#include <iostream>
#include <string>
#include <vector>
#include "head.hpp"
int main(){
int choice=0,test=1;
int session_counter =logCounter();//to log the day-count at the time of execution
int day_count=0;
double budget;
double tot_exp,save,cumulat_exp=0.0;
bool x=true;
do{ //loop for entire operation
menu();
if(test==0){
std::cout<<"Invalid choice !.TRY AGAIN..\n";
test=1;
}
std::cout<<"Enter your choice :";
std::cin>>choice;
switch(choice){
case 1: budget= askBudget();
break;
case 2: tot_exp=dailyExpLog(session_counter);
cumulat_exp +=tot_exp; //to caculate cumulative total costs over the passed days
day_count++;
save=calc_save(budget,cumulat_exp,day_count); //for directly choosing insights option before warnings options
break;
case 3: save=warning(budget,cumulat_exp,day_count);
break;
case 4: weekLog(session_counter);
break;
case 5:dispHistory();
break;
case 6: insights(save,budget,day_count);
break;
case 7: x=false;
break;
default:test=0;
break;
}
}while(x);
std::cout<<"Thank you, have a nice day."<<'\n';
std::cout<<"-----------------"<<'\n';
return 0;
}