Sunday, October 20, 2013

uri OJ 1008 Salary problem c++ solution

uri OJ 1008 problem link: http://www.urionlinejudge.com.br/judge/en/problems/view/1008

uri OJ 1008 Salary problem: URI Online Judge | 1008

Salary

Timelimit: 1
Write a program that reads the number of an employee, the number of hours that he worked in a month and the amount he received per hour. Print the employee number and the salary that he will receive at end of the month, rounded to two decimal places.
- Don’t forget to print end line after the result otherwise you will get “Presentation Error”.
- Don’t forget the space before and after the equal signal and after the U$.

Input

The input file contains 2 integer numbers and 1 floating-point number, respectively the number, hours worked and the among received by an hour worked.

Output

Print the number and the salary of the employee, according to the given example, with a blank space before and after the equal signal.
Sample InputSample Output
25
100
5.50
NUMBER = 25
SALARY = U$ 550.00
and here is my c++ solution to uri OJ 1008 Salary problem:

#include <iostream>
#include <iomanip>
using namespace std;

int main() {
// your code goes here
float a, b, c;
cin>>a>>b>>c;
cout<<"NUMBER = "<<a<<endl<<fixed<<setprecision(2)<<"SALARY = U$ "<<b*c<<endl;
return 0;
}

1 comment: