Basic Paycheck Calculator

I'm trying to learn C++ Programming in Linux and have decided to m

Page 1 of 1

2 Replies - 2455 Views - Last Post: 21 November 2008 - 02:15 AM Rate Topic: -----

#1 ZMAN86  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-November 08

Basic Paycheck Calculator

Post icon  Posted 19 November 2008 - 08:03 PM

I'm trying to learn C++ Programming in Linux and have decided to make a basic paycheck calculator, however, I am not getting too far with this task. This is what I have so far. Can anybody give me any advice on this subject?

#include <stdio.h>

int main(void)
{
printf("enter hours worked:");
printf("enter pay rate:);
return(0);
}
Is This A Good Question/Topic? 0
  • +

Replies To: Basic Paycheck Calculator

#2 DaneAU  Icon User is offline

  • Great::Southern::Land
  • member icon

Reputation: 284
  • View blog
  • Posts: 1,617
  • Joined: 15-May 08

Re: Basic Paycheck Calculator

Posted 19 November 2008 - 09:57 PM

Well you might need to do some reading on variables... As in int, float, double, bool, string, char... You will need to do something to take in the input, which i will leave to you to read up on - plenty of examples on here if you use the search function of this site ;)

Also some other stuff would be looking at + - = * / and how they work... Anyway here is an example

#include <iostream>

using namespace std;

double payRate = 15; // 15 dollars an hour
int hoursWorked = 10;
double totalPay = payRate * hoursWorked;

int main()
{
      cout << "Pay Earnt $ " << totalPay << endl;
      return 0;
}


Was This Post Helpful? 0
  • +
  • -

#3 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 990
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

Re: Basic Paycheck Calculator

Posted 21 November 2008 - 02:15 AM

View PostZMAN86, on 19 Nov, 2008 - 07:03 PM, said:

I'm trying to learn C++ Programming in Linux and have decided to make a basic paycheck calculator, however, I am not getting too far with this task. This is what I have so far. Can anybody give me any advice on this subject?
#include <stdio.h>

int main(void)
{
printf("enter hours worked:");
printf("enter pay rate:);
return(0);
}



If you have a look at what I have done to your posting you'll see that your code is now in a box called 'code'.
I did this by wrapping the code in "[co de]" and "[/co de]" (without the spaces).
This is what posting rule 3 is asking you to do and it is good manners to do so when making a posting.
Just some feedback to help you make friends more easily here.

On your main question.
Welcome to the wonderful world of C++.
It's a great journey and good to see you taking the first steps down the path.
It does seem you are taking just the first steps and you may find working through this free online tutorial will give you a great starting place.
http://www.cplusplus.com/doc/tutorial/
There's a lot to learn but it is worth it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1