So I recently started to try and learn the C++ programming language. I've been reading through a book about it and it has been going great except for one problem. They have no tests or anything at the end of the chapters so you really have no idea if what they just told you actually stuck in your brain or just went in and then out again. So I decided to try and create a basic program with the knowledge that I have already and was hoping that everyone here could let me know how I did and give some comments so I can see if I'm actually learning or not.
What I have learned so far is variables, functions, (kind of touched on headers and other source files), basically all the basic stuff. I'm about halfway through the chapter on pointers at the time of writing this code. So hopefully that gives you a idea how much I know so far.
But anyways I decided to write a program that can calculate your bi-monthly paycheck after taxes in Minnesota. The user enters his hourly wage and it returns how much he will make every 2 weeks. Was going to have the user be able to type how many hours a week he works also but I was not able to figure out how to do that yet. But enough of my yapping here is the code I created in Codeblocks.
Thanks in advance for taking the time to look at this and give me some comments on how I did and how I could make it better. I am still very much a beginner at this and would value your feedback even it means that my code really sucksThanks in advance for taking the time to look at this and give me some comments on how I did and how I could make it better. I am still very much a beginner at this and would value your feedback even it means that my code really sucksCode:#include <iostream> // This is my first program I have every written. Im currently trying to teach myself C++ and decided // to try and write a program to figure anyones pay in minnesota after taxes. I'm still very new // at this and have alot to learn. If you have any pointers on how to clean up the code let me know. using namespace std; // Below is my function to do the math for minnesota taxes and find the bi monthly pay. void Mymonthly(double *myparam) { double MySocial; double MyMedicare; double taxnumber; (*myparam) *= 40.0; (*myparam) *= 2.0; if ((*myparam) <= 11) { taxnumber = (*myparam) * .0535; } if ((*myparam) >= 38) { taxnumber = (*myparam) * .0785; } if ((*myparam) >= 12) { taxnumber = (*myparam) * .0705; } MyMedicare = (*myparam) * .0145; MySocial = (*myparam) * .0420; (*myparam) -= taxnumber; (*myparam) -= MyMedicare; (*myparam) -= MySocial; cout << "Your bi-monthly paycheck after minnesota taxes will be: " << (*myparam) << endl; } int main() { double myWage; cout << "Hello this program lets you find out how much you will make from your paycheck." << "Please enter your hourly wage now. " << endl; cin >> myWage; Mymonthly(&myWage); cout << Mymonthly << endl; return 0; } // Thanks for looking remember that im still learning and try not to be to critical since ive only // just got to the part in the book that teaches my about pointers and stuff ;p. ~ Zereo
..
Oh and I noticed that every time I run the program it returns a 1 right under the bi-monthly pay line. I'm not sure what is causing this but i think it has something to do with my function being wrong somewhere.