From 28bb6c3d56aec142a0922a739a70d9d5baa9c6ed Mon Sep 17 00:00:00 2001 From: Sagnik Roy <58679327+sagnik1511@users.noreply.github.com> Date: Sun, 24 Jan 2021 11:50:13 +0530 Subject: [PATCH] Added beautifying features --- test-prep.cpp | 145 ++++++++++++++++++++++++-------------------------- 1 file changed, 70 insertions(+), 75 deletions(-) diff --git a/test-prep.cpp b/test-prep.cpp index b707356..edcf81d 100644 --- a/test-prep.cpp +++ b/test-prep.cpp @@ -88,38 +88,6 @@ void printJobScheduling(subject arr[], int n) cout<<"\n"<=0; j--) -// { -// -// if (slot[j]==false) -// { -// result[j] = i; // Add this job to result -// slot[j] = true; // Make this slot occupied -// break; -// } -// } -// } -// -// -// for (int i=n-1; i>=0; i--) -// { -// if (slot[i]) -// { cout <=W){return 0.0;} @@ -239,19 +209,20 @@ int main() int n; cout << "Enter the no. of topics: "; cin >> n; - + cout<<"--------------------------------------------------------\n"; int total_diff = 0; // sp topic t[2 * n]; - cout << "Enter name of each topic: "; + cout << "Enter name of each topic: \n"; for (int i = 0; i < n; i++) { + cout<> t[i].name; } - cout << "Enter priority of each topic i.e. expected weightage: "; + cout << "--------------------------------------------------------\nEnter priority of each topic i.e. expected weightage: \n"; for (int i = 0; i < n; i++) { @@ -262,7 +233,8 @@ int main() t[i].count = 0; } - cout << "Enter difficulty level of each topic based on your own understanding from(1-10) 1 being the easiest: "; + cout << "--------------------------------------------------------\n"; + cout<<"Enter difficulty level of each topic based on your own understanding from(1-10) 1 being the easiest: \n"; for (int i = 0; i < n; i++) { @@ -275,37 +247,48 @@ int main() float total_time; // tt float focused_time; // eff - cout << "Enter total time available to study this subject in hours: "; + cout << "--------------------------------------------------------\nEnter total time available to study this subject in hours: "; cin >> total_time; - cout << "How much you can resist yourself from using phone during exams?(1-10): "; + cout << "--------------------------------------------------------\nHow much you can resist yourself from using phone during exams?(1-10): "; cin >> focused_time; - + + cout<<"\n--------------------------------------------------------\n"; + float available_time = total_time * focused_time / 10; //at cout << "Allotted time: " << available_time << "\n"; cout << "Difficulty Level: " << total_diff << "\n"; float utilised_val = available_time / total_diff; //ut cout << "Utilization Time: " << utilised_val << "\n"; - + + cout<<"--------------------------------------------------------\n"; + for (int i = 0; i < n; i++) { t[i].time = utilised_val * t[i].difficulty / 10; - cout << t[i].name << " " << t[i].time * 10 << "\n"; + cout << t[i].name << " ---> " << t[i].time * 10 << "\n"; } - + + cout<<"--------------------------------------------------------\n"; + int checksub; - cout << "The time is: "; - cout << "Please check if you will be able to complete the topics in the given time \nIf okay press 1 else press 0: "; + cout << "The time is: \n"; + for (int i = 0; i < n; i++) { - cout << t[i].name << " " << t[i].time << "\n"; + cout << t[i].name << " ---> " << t[i].time << "\n"; } - + + cout<<"\n--------------------------------------------------------\n"; + + cout << "Please check if you will be able to complete the topics in the given time \nIf okay press 1 else press 0: "; cin >> checksub; - + + cout<<"\n--------------------------------------------------------\n"; + if (checksub == 0) { - cout << "You can enter the time manually: "; + cout << "You can enter the time manually: \n"; for (int i = 0; i < n; i++) { cin >> t[i].time; @@ -330,8 +313,8 @@ int main() double prepared = fractionalKnapsack(available_time, t, 2 * n); - cout << prepared; - return 0; + cout << prepared<<"\n--------------------------------------------------------\n"; + //return 0; } else if (option == 0) @@ -345,16 +328,17 @@ int main() subject s[n]; int tcred = 0; - cout << "Enter name and credits for each subject: "; + cout << "Enter name and credits for each subject: \nPrint the name and the credits separating with a space \n"; + cout<<"--------------------------------------------------------\n"; for (int i = 0; i < n; i++) { - + cout<< i+1<<") "; cin >> s[i].sname >> s[i].credits; tcred += s[i].credits; } int date; - cout << "Enter today's date (Format: dd): "; + cout << "--------------------------------------------------------\nEnter today's date (Format: dd): "; cin >> date; int month; @@ -362,39 +346,44 @@ int main() cin>>month; int tgive; - - cout << "How much time can you give each day to studies(in hours): "; + cout << "--------------------------------------------------------\nHow much time can you give each day to studies(in hours): "; cin >> tgive; - cout << "Enter the date and month for the following exams: \n"; + cout << "--------------------------------------------------------\nEnter the date and month for the following exams: \n\n"; for (int i = 0; i < n; i++) { - cout << s[i].sname << ":\nenter date: "; - + //cout << s[i].sname << ":\nenter date: \n"; + cout<< "Date of the exam for subject "<> s[i].examdate; - cout << "enter month: "; +// cout << "\nenter month: "; + cout<< "Month of the exam for subject "<>s[i].exam_month; if(s[i].exam_month==month){//calculating the time left if the exam is on the same month as the date s[i].time_left=s[i].examdate-date+1; - cout<<"time left:"<<" "<month){//calculating the time left if the exam is scheduled in later months if(s[i].examdate>date){ int month_value=s[i].exam_month-month; s[i].time_left = month_value*(30+abs(s[i].examdate - date + 1)); - cout<<"time left: "<> s[i].sname >> s[i].credits >> s[i].topics; ttopic += s[i].topics; } @@ -460,23 +450,27 @@ int main() for (int i = 0; i < n; i++) { - cout << "Enter name of each topic with its weightage in exam and difficulty level for you (from 1-10 \n 1 being the easiest) for the subject\n "; + cout << "Enter name of each topic with its weightage in exam and difficulty level for you \n(from 1-10 1 being the easiest) for the subject\n\n "; - cout << s[i].sname << ": "; + cout << s[i].sname << ": \n"; for (int j = 0; j < s[i].topics; j++) { + cout<<"Topic "<> it[y].name >> it[y].weightage >> it[y].difficulty; it[y].imp = it[y].weightage * s[i].credits * it[y].difficulty; y++; } + cout<<"\n--------------------------------------------------------\n"; } - + + + cout << "Do you want to do major chapters first ( press 1 ) or the most difficult ones (press 0)? "; cin >> ask; - + cout<<"--------------------------------------------------------\n"; if (ask == 0) { @@ -504,6 +498,7 @@ int main() cout << it[i].name << "\n"; } } + cout<<"--------------------------------------------------------\n"; } user_feedback(); return 0;