-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweekLog.cpp
More file actions
23 lines (22 loc) · 876 Bytes
/
weekLog.cpp
File metadata and controls
23 lines (22 loc) · 876 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//This code computes the weekky log display function with week
#include <iostream>
#include <fstream>
#include "head.hpp"
void weekLog(int session_counter){
if (session_counter==7){ // weekly report generates only after completing 7 days or a week
std::cout<<"The weekly report is ready .....\n";
std::ifstream file("expense_log.txt");
if(file.is_open()){
std::string line;
while(std::getline(file,line)){ //to print content from the text file to the console.
std::cout<<line<<std::endl;
}
file.close();
} else{
std::cout<<"UNABLE to open the file.\n";
}
}
else{
std::cout<<"The week is NOT over yet. "<<7-session_counter<<" log days left !!\n"; //logic statement in case the user requests week log before a week is completed
}
}