Write a complete C++ program that can be used to print the ASCII codes of all th
ID: 3783530 • Letter: W
Question
Explanation / Answer
// C++ code
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <iomanip> // std::setw
#include <time.h> /* time */
using namespace std;
//main fuction
int main()
{
cout << "a: " << int('a') << endl;
cout << "e: " << int('e') << endl;
cout << "i: " << int('i') << endl;
cout << "o: " << int('o') << endl;
cout << "u: " << int('u') << endl;
cout << "A: " << int('A') << endl;
cout << "E: " << int('E') << endl;
cout << "I: " << int('I') << endl;
cout << "O: " << int('O') << endl;
cout << "U: " << int('U') << endl;
return 0;
}
/*
output:
a: 97
e: 101
i: 105
o: 111
u: 117
A: 65
E: 69
I: 73
O: 79
U: 85
*/
// C++ code
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <iomanip> // std::setw
#include <time.h> /* time */
using namespace std;
//main fuction
int main()
{
double income;
double finalIncome;
double taxes;
cout << "Enter income: ";
cin >> income;
if (income <= 10000)
{
taxes = 0;
finalIncome = income;
}
else if (income <= 30000)
{
taxes = 0.1*(income-10000);
finalIncome = income - taxes;
}
else if (income <= 60000)
{
taxes = 2000 + 0.15*(income-30000);
finalIncome = income - taxes;
}
else if (income > 60000)
{
taxes = 6500 + 0.2*(income-60000);
finalIncome = income - taxes;
}
cout << "Final Income: " << finalIncome << endl;
cout << "Taxes: " << taxes << endl;
return 0;
}
/*
output:
Enter income: 56000
Final Income: 50100
Taxes: 5900
*/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.