You'd be surprised how simple parts of open source OS's are. The kernel can be tetchy but in userspace there are a lot of very simple tools to build, fix, and extend.
I do not have a positive attitude about Windows updates since the one evening it told me there were "updates" and when I went ahead and did them it started a 3-hour process of updating with no warning.
_________________ "Hysterical children shrieking about right-wing anything need to go sit in the corner and be quiet while the adults are talking."
Joined: Thu Sep 03, 2009 9:59 am Posts: 15740 Location: Combat Information Center
Aaaand on top of that, it turns out the copy of visual studio I got was for a 30 day trial period and now it wants me to sign into a Microsoft account and use Azure and so forth.
Nope.
Guess it's cygwin for me, if I can figure out which components I need to download. I refuse to create an account with Microsoft for any purpose whatsoever or participate in any of their programs under any circumstances. I most likely won't use any Windows 10 Linux for the same reason; no doubt they'll want to shove some cloud storage crap on you along with it. I expect I'd learn more from the experience of installing Linux the old-fashioned way anyhow rather than the MS "we'll do everything for you and treat your computer like it's a cell phone" attitude.
_________________ "Hysterical children shrieking about right-wing anything need to go sit in the corner and be quiet while the adults are talking."
Joined: Thu Sep 03, 2009 9:59 am Posts: 15740 Location: Combat Information Center
I wrote this program to try to see where I was at as far as writing something beyond just expanding book examples, and also since I need to figure out what courses to transfer in for my program (I'm not going to be able to start a Master's program without first getting my undergraduate grades up) and which to leave out - don't want to drag down my stating GPA too much, but I also don't want to re-take a ton of extraneous stuff.
Spoiler:
Code:
// GPAcalculator.cpp : Defines the entry point for the console application.; // Program requests number of credits earned and grades in those credits and returns a GPA; // Improvements to be made: Output data to a text file, including summary of inputs given by the user; // allow for calculation based on percentage grades rather than letters; // add summary of grades earned by letter to output;
double grade_values[12]{ 4.0, 3.7, 3.3, 3.0, 2.7, 2.3, 2.0, 1.7, 1.3, 1.0, 0.7, 0.0 }; //standardized values for GPA calculation string grade_letters[] = { "A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D+", "D", "D-", "F" }; //standardized letter grades double hours_taken[12]; // receives inputs of hours taken at each letter grade double total_credits = 0.0; //for keeping track of accumulated credit double total_hours = 0.0; //for keeping track of total course hours double input_hours(); double additional_hours(double total_hours, double total_credits); // for credit hours that received GPA values not corresponding to a letter grade. string yes = "Y"; string yes_no; void produce_summary(double total_hours, double total_credits);
int main() { cout << "For each letter grade, enter the total number of hours for courses in which you were awarded that grade." << endl; input_hours(); cout << "Do you need to input any course hours at non-standard GPA values? Enter Y for 'YES'; any other input for 'NO' to receive an average and input summary." << endl; cin >> yes_no; if (yes_no == yes) { //determine if the user needs to input any GPA values that do not correspond to typical letter grade values additional_hours(total_hours, total_credits); } produce_summary(total_hours, total_credits); return 0; }
double input_hours() { //function asks for hours taken at each letter grade successively int counter = 0; double temp_credits = 0.0; //for calculating total points towards GPA prior to averaging while (counter <= 11) { cout << "Enter the number of course hours completed with a grade of " << grade_letters[counter] << "." << endl; cin >> hours_taken[counter]; total_hours = total_hours + hours_taken[counter]; //keeps track of total course hours completed temp_credits = hours_taken[counter] * grade_values[counter]; //calculate credit accumulated for grade most recently input total_credits = total_credits + temp_credits; //total accumulated credits prior to averaging ++counter; } return total_credits; }
double additional_hours(double total_hours, double total_credits) { // function calculates values for GPAs that do not correspond to typical letter grades double nonstandard_value = 0.0; double nonstandard_hours = 0.0; double nonstandard_product = 0.0; cout << "Input the nonstandard GPA value to use for additional hours." << endl; cin >> nonstandard_value; cout << endl << "Input the number of hours taken for which this GPA was awarded." << endl; cin >> nonstandard_hours; nonstandard_product = nonstandard_hours * nonstandard_value; total_hours = total_hours + nonstandard_hours; total_credits = total_credits + nonstandard_product; //after calculating the credit value for nonstandard grades, add to the total for summary function call cout << endl << "Do you have any other nonstandard GPA values to input? Enter 'Y' for YES, any other input to receive your summary." << endl; cin >> yes_no; if (yes_no == yes) { //determine if the user needs to input any more nonstandard GPA values additional_hours(total_hours, total_credits); } else { return total_credits; } }
void produce_summary(double total_hours, double total_credits) { // summarizes the total hours taken, credit received, and final GPA double average_gpa = total_credits / total_hours; cout << endl << "Total number of course hours taken: " << total_hours << endl << "Total credit accumulated: " << total_credits << endl << "Final GPA: " << average_gpa <<endl; return; }
For additional exercise, I plan to eventually make it summarize how many of each grade were input, and (when I learn to do such things) make it use a very basic GUI rather than a DOS-like text input.
The one thing I couldn't figure out was how to make it accept either 'y' or 'Y', so presently it's case sensitive, and if the user puts in a lowercase Y it will end rather than calling the nonstandard grades function.
I don't know how efficient or elegant this solution is, but this is what I've learned so far.
_________________ "Hysterical children shrieking about right-wing anything need to go sit in the corner and be quiet while the adults are talking."
Joined: Thu Sep 03, 2009 9:59 am Posts: 15740 Location: Combat Information Center
Turns out it wasn't working as well as I thought. I fixed it here, and cleaned it up a bit, mainly by eliminating almost all of the global variables.
Spoiler:
Code:
// GPAcalculator.cpp : Defines the entry point for the console application.; // Program requests number of credits earned and grades in those credits and returns a GPA; // Improvements to be made: Output data to a text file, including summary of inputs given by the user; // allow for calculation based on percentage grades rather than letters; // add summary of grades earned by letter to output;
double total_hours = 0.0; //for keeping track of total course hours double input_hours(); double additional_hours(double total_hours, double total_credits); // for credit hours that received GPA values not corresponding to a letter grade. void produce_summary(double total_hours, double total_credits);
int main() { char yes_no[2]; double total_credits = 0.0; cout << "For each letter grade, enter the total number of hours for courses in which you were awarded that grade." << endl; total_credits = input_hours(); cout << "Do you need to input any course hours at non-standard GPA values? Enter Y for 'YES'; any other input for 'NO' to receive your summary." << endl; cin >> yes_no; yes_no[0] = toupper(yes_no[0]); if (yes_no[0] == 'Y') { //determine if the user needs to input any GPA values that do not correspond to typical letter grade values total_credits = additional_hours(total_hours, total_credits); } produce_summary(total_hours, total_credits); return 0; }
double input_hours() { //function asks for hours taken at each letter grade successively int counter = 0; double grade_values[12]{ 4.0, 3.7, 3.3, 3.0, 2.7, 2.3, 2.0, 1.7, 1.3, 1.0, 0.7, 0.0 }; //standardized values for GPA calculation string grade_letters[12] = { "A", "A-", "B+", "B", "B-", "C+", "C", "C-", "D+", "D", "D-", "F" }; //standardized letter grades double hours_taken[12]; // receives inputs of hours taken at each letter grade double temp_credits = 0.0; //for calculating total points towards GPA prior to averaging double credits = 0.0; //for keeping track of accumulated credit while (counter <= 11) { cout << "Enter the number of course hours completed with a grade of " << grade_letters[counter] << "." << endl; cin >> hours_taken[counter]; total_hours = total_hours + hours_taken[counter]; //keeps track of total course hours completed temp_credits = hours_taken[counter] * grade_values[counter]; //calculate credit accumulated for grade most recently input credits = credits + temp_credits; //total accumulated credits prior to averaging ++counter; } return credits; }
double additional_hours(double base_hours, double base_credits) { // function calculates values for GPAs that do not correspond to typical letter grades double nonstandard_value = 0.0; double nonstandard_hours = 0.0; double nonstandard_product = 0.0; char yes_no[2]; cout << "Input the nonstandard GPA value to use for additional hours." << endl; cin >> nonstandard_value; cout << endl << "Input the number of hours taken for which this GPA was awarded." << endl; cin >> nonstandard_hours; nonstandard_product = nonstandard_hours * nonstandard_value; total_hours = base_hours + nonstandard_hours; double total_credits = base_credits + nonstandard_product; //after calculating the credit value for nonstandard grades, add to the total for summary function call cout << endl << "Do you have any other nonstandard GPA values to input? Enter 'Y' for YES, any other input to receive your summary." << endl; cin >> yes_no; yes_no[0] = toupper(yes_no[0]); if (yes_no[0] == 'Y') { //determine if the user needs to input any more nonstandard GPA values return additional_hours(total_hours, total_credits); } else { return total_credits; } }
void produce_summary(double total_hours, double total_credits) { // summarizes the total hours taken, credit received, and final GPA double average_gpa = total_credits / total_hours; cout << endl << "Total number of course hours taken: " << total_hours << endl << "Total credit accumulated: " << total_credits << endl << "Final GPA: " << average_gpa <<endl; }
This little project greatly improved my understanding of how arguments are passed to functions and how it passes a result back. I also got a better appreciation for why to avoid global variables, and how to utilize text strings. I found the book descriptions of these things hard to follow, so actually using them really helped make it all more clear.
_________________ "Hysterical children shrieking about right-wing anything need to go sit in the corner and be quiet while the adults are talking."
Joined: Thu Sep 03, 2009 9:59 am Posts: 15740 Location: Combat Information Center
I will try to find one in whichever program I end up in.
The book is moving on to classes and objects and I'm completely mystified, but I've only had about 45 minutes to read on the subject so I guess that's not a surprise.
_________________ "Hysterical children shrieking about right-wing anything need to go sit in the corner and be quiet while the adults are talking."
Users browsing this forum: No registered users and 42 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum