#include <iostream>
#include <string>
usingnamespace std;
int main()
{
string name;
double salary, deduction;
short days_worked_per_week;
cout << "Input you name: ";
cin >> name;
cout << "Input salary: ";
cin >> salary;
//....get any other inputs you need
double weekly_salary = salary*days_worked_weekly//assuming the salary is per day
double monthly_salary = //include formula here
//...include any other formulas here
cout << "Your name is: " << name << endl;
cout << "Your salary per week is: " << weekly_salary << endl;
//...display any other ouput you need to display
return 0;
}
thx for your reply..as of now, i dont know the use of short..and when and how to use double..i dont know how to defend it..here's my code but stil incomplete coz i dont know how to extend d coding after return 0..
#include<iostream.h>
int main()
{
char james[20];
int a,b,philhealth,bir,pagibig,salary,c,d,e;
int pay (int b);
cout<< "Please input your name:\n";
cin>>james;
cout<< "Please input your salary:\n";
cin>>salary;
cout<< "Please input no of days work:\n";
cin>>a;
b=(salary*a);
cout<<b;
return 0;
}
after dis, there is another computation for all deductions, computation is simple but d problem is i dont know how to input it in c++..='c
Just as a side note, when you post your code first click on the "<>" button to the right of where you write your posts under "format" and then proceed to write your code between the two sets of square brackets.
"double" and "short" are two different data types. When you want to store a variable you have to tell the computer if it's going to be a non-integer real number (for e.g. 1.23, 3.14159, 2.73) or strictly an integer. variables of "double" data type store non-integer real numbers where as variables of the "short" data type store integers. For storing the salary, for example, you would want to use a double because you want to be able to store values like 6.75 (USD/hr) for example, which is a non-integer real number.
return 0; is the final line the program executes. It tells a program to quit, basically. If you have more lines to add to this program then it would have to be before this line.
You should avoid naming your integers ambiguous names like "a," "b," etc., if not for your sake then for the people reading your code.
I suggest you scour online for more information. The information is very easy to come by on the internet. I haven't seen this entire video so I'm not sure I can recommend it but why don't you start here perhaps: http://www.youtube.com/watch?v=nziy2_U5JQI
to know the code after return 0..
I've already computed d monthly salary so what i need to know is how i will insert and what code i need to insert for the computation of..
SSS = (salary*.03)
BIR = (salary*.05)
Philhealth = (salary*.06)
Pagibig = (salary*.2)