answersLogoWhite

0

What else can I help you with?

Continue Learning about Engineering

How do you write code C plus plus program to compute nett salary for 5 employees given that the allowance is 20 percent of basic pay and income tax is 30 percent of the gross salary?

#include<iostream> #include<string> #include<sstream> int main() { for (size_t employee=1; employee<=5; ++employee) { bool ok = false; while (!ok) { std::string input; std::cout << "Employee #" << employee << std::endl; std::cout << "Enter basic pay: "; std::getline (std::cin, input); std::stringstream ss; ss << input; double pay; if (ss >> pay) { double allowance = pay * 20 / 100; double tax = (pay-allowance) * 30 / 100; double nett = pay - tax; std::cout << "Basic pay:\t" << pay << std::endl; std::cout << "Allowance:\t" << allowance << std::endl; std::cout << "Tax:\t\t" << tax << std::endl; std::cout << "Nett:\t\t" << nett << std::endl; ok = true; } else { std::cout << "Bad input\n"; } } std::cout << std::endl; } }


How do you use sin in c plus plus?

#include<iostream> int main() { std::cout << "sin(1) = " << std::sin(1.0) << std::endl; std::cout << "cos(1) = " << std::cos(1.0) << std::endl; std::cout << "tan(1) = " << std::tan(1.0) << std::endl; std::cout << "asin(1) = " << std::asin(1.0) << std::endl; std::cout << "acos(1) = " << std::acos(1.0) << std::endl; std::cout << "atan(1) = " << std::atan(1.0) << std::endl; } Output: sin(1) = 0.841471 cos(1) = 0.540302 tan(1) = 1.55741 asin(1) = 1.5708 acos(1) = 0 atan(1) = 0.785398


How do you split a string in delimit c plus plus?

#include<iostream> #include<vector> #include<string> std::vector<std::string> parse (const std::string& s, const char delim) { std::vector<std::string> result {}; auto start = 0U; auto end = s.find (delim); while (end != s.npos) { result.push_back (s.substr(start, end - start)); start = ++end; end = s.find (delim, start); } result.push_back (s.substr (start, s.npos - start)); return result; } std::vector<std::string> parse (const std::string& s, const std::string& delim) { std::vector<std::string> result {}; auto start = 0U; auto end = s.find (delim); while (end != s.npos) { result.push_back (s.substr(start, end - start)); start = end + delim.length(); end = s.find (delim, start); } result.push_back (s.substr (start, s.npos - start)); return result; } int main() { std::string str1 = "This is a string that will be parsed by a single-space delimiter."; std::string str2 = "This==is==a==string==that==will==be==parsed==by==equal==operator."; std::string str3 = "This string has no delimiter."; std::cout << str1 << std::endl; std::vector<std::string> v1 = parse (str1, ' '); for (auto i : v1 ) std::cout << i << std::endl; std::cout << std::endl; std::cout << str2 << std::endl; std::vector<std::string> v2 = parse (str2, "=="); for (auto i : v2 ) std::cout << i << std::endl; std::cout << std::endl; std::cout << str3 << std::endl; std::vector<std::string> v3 = parse (str3, '\\'); for (auto i : v3 ) std::cout << i << std::endl; std::cout << std::endl; }


A c comma c plus plus program that can accept first name surname and display it?

int main() { std::string first, last; std::cout << "Enter your first name: "; std::cin >> first; std::cout << "Enter your last name: "; std::cin >> last; }


How C plus plus program to implement employee directory which will let the organization to perform the functions. Insert the record of new employee?

#include<iostream> #include<vector> #include<string> struct employee { std::string forename; std::string surname; std::string department; }; struct directory { std::vector<employee> v; void add_employee (const std::string&, const std::string&, const std::string&); }; void directory::add_employee (const std::string& forename, const std::string& surname, const std::string& department) { v.push_back (employee{forename, surname, department}); } int main() { std::string forename, surname, department; std::cout << "Enter employee's forename: "; std::cin >> forename; std::cout << "Enter employee's surname: "; std::cin >> surname; std::cout << "Enter employee's department: "; std::cin >> department; add_employee (forename, surname, department); }

Related Questions

What is the STD rate at Cumberland County College?

The STD rate at Cumberland County College has dropped over the years from 40 percent down to 26 percent, but then rose again to 35 percent.


What state you can't get married in with an STD?

There is no state in the U.S. that prohibits individuals with a sexually transmitted disease (STD) from getting married. However, it is important to disclose your STD status to your partner and practice safe sex to prevent transmission.


After getting an STD i haven't been able to get pregnant?

STD's usually don't prevent pregnancy. Are you trying or are just wanting to know?


Does percent uncertainty measure accuracy?

Accuracy STD on the other hand measures precision.


What percent sexually active teens contract STD each year?

50% you welcome


What are the chances of getting an STD from swallowing semen?

somewhere around 0%


Can you catch anything from getting a tattoo using dirty needles?

you can get an std


When is 10th std public practical exam?

an average human use how much percent of brain


Are Condoms are 100 percent effective in preventing STD and pregnancy?

Unless they break during intercourse.


Why is someone who already has STD at risk of getting HIV?

Because having a STD compromises the immune system which will allow the virus to transfer more easily.


How do you write code C plus plus program to compute nett salary for 5 employees given that the allowance is 20 percent of basic pay and income tax is 30 percent of the gross salary?

#include<iostream> #include<string> #include<sstream> int main() { for (size_t employee=1; employee<=5; ++employee) { bool ok = false; while (!ok) { std::string input; std::cout << "Employee #" << employee << std::endl; std::cout << "Enter basic pay: "; std::getline (std::cin, input); std::stringstream ss; ss << input; double pay; if (ss >> pay) { double allowance = pay * 20 / 100; double tax = (pay-allowance) * 30 / 100; double nett = pay - tax; std::cout << "Basic pay:\t" << pay << std::endl; std::cout << "Allowance:\t" << allowance << std::endl; std::cout << "Tax:\t\t" << tax << std::endl; std::cout << "Nett:\t\t" << nett << std::endl; ok = true; } else { std::cout << "Bad input\n"; } } std::cout << std::endl; } }


Which std is so common that 50 percent of sexually active adults contract at some point in their lifetime?

if your in a+ , its HPV.