SOURCE CODE:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float a=345.24681359;
std::cout << std::setprecision(3);
cout<<"Question e "<<std::scientific<<endl;
cout<<std::setfill('_')<<std::setw(10);
cout<<a;
cout<<endl;
std::cout << std::setprecision(4);
cout<<"Question f
"<<std::defaultfloat<<endl;
cout<<a;
cout<<endl;
cout<<"Question g
"<<std::defaultfloat<<endl;
cout<<a;
cout<<endl;
std::cout << std::setprecision(3);
cout<<"Question h "<<std::fixed<<endl;
cout<<"bb"<<a;
cout<<endl;
std::cout << std::setprecision(4);
cout<<"Question i "<<std::fixed<<endl;
cout<<std::setfill('*')<<std::setw(12);
cout<<a;
cout<<endl;
cout<<"Question j "<<std::hexfloat<<endl;
cout<<a;
cout<<endl;
return 0;
}
SCREENSHOTS:
Assignnment #1 Your Very First C++ Program Write a C+program to achieve the followings. Start a new line for each...
Summary: Write a C program that prompts the user to enter 2 positive integer numbers, display the numbers in 3 formats. Then check, whether the larger of the 2 is evenly divisible by the smaller. Detail: Write a complete C program, more complex than the typical "hello world" program. Prompt the user to enter 2 integer numbers that are not negative. After either entry, display that number again. Print the smaller in hexadecimal, in decimal, and in octal format. Include...
Write a C program which will display the contents of a file in base-16 (hexadecimal) and in ASCII. Complete the following tasks: Obtain the name of the input file from the command line. If the command-line is “./hexdump xxx.bin” then argv[1] will contain “xxx.bin”. Open the file for binary input Print the entire file, 16-bytes per line. Each line should begin with an 8-digit hexadecimal offset into the file. This is the count of the bytes that you have already...
(1) (50%) Write a C program that takes as input a fully parenthesized, arithmetic expression of binary operators +, -,*,/, and converts the expression into a binary expression tree. Your program should take input from the command line. The entire expression should be in a character string without any space in it An input string only includes floating numbers in the format of Y.YY, that is, one digit to the left of the decimal point and two digits to the...
Please help me with this program. Using C++ (printf & scanf) statements. Thank you. ASSIGNMENT: Write a program to ask the user for a number that includes a decimal point. Then display the integer part of the number (the part of the number to the left of the decimal point) and the decimal part of the number (the part of the number to the right of the decimal point, including the decimal point Follow the 3 steps in the Information...
To write a C program (not C++) that converts numbers between Decimal and IEEE-754 format and vice versa. Inputs: Number in Decimal format (including special case of 0) Number in IEEE-754 format (including special cases) Output: Equivalent number in IEEE-754 format Equivalent number in Decimal Specification: The program converts a number based on choosing from a menu of choices, where each choice calls the appropriate procedure, where the choices are: Decimal to IEEE-754 conversion IEEE-754 to Decimal conversion Quit program...
The utility department of Brentwood City needs you to write a C++ program that will print out a customer's bill. The program should input the following items from the file named "utility.txt" (which you may copy from the class data share or Blackboard): The customer number (6-digit integer) The number of gallons of water used (floating-point, no more than 999.99) The number of kilowatts of electricity used (integer, no more than 999) The number of cubic feet of natural gas...
Your program must evaluate algebraic expressions over real numbers in Reverse Polish Notation (RPN). + (addition), - (subtraction), * (multiplication) and / (division) should be treated as arithmetic operations. Depending on the selection, numerical values must be entered and displayed in decimal, hexadecimal or binary form. Example: The expression ((3+4) *(7+1.6-12) -5) / (3-8.7)Will be calculated on your RPN calculator as 3 4 + 7 1.6 + 12 - * 5 - 3 8.7 - / Your RPN computer's user...
A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f}'.format(your_value)) Ex: If the input is: 5345 the output is: 2.67 Your program must define and call the following function. The function should return the amount of miles walked. def steps_to_miles(user_steps) answer must be in Phython...
The answer below is correct, but can you guys show me
how to get it? I need conplete solution. thanks
Consider a 16-bit floating-point representation based on the IEEE floating-point format, with one sign bit, seven exponent bits (k=7), and eight fraction bits (n:8). The exponent bias is 27-1-1-63. Fill in the table that follows for each of the numbers given, with the following instructions for each column: Hex: the four hexadecimal digits describing the encoded form. M the value...
**This is for the C Language. Trigonometric Calculator Specification You are required to write a program that calculates and displays values of the trigonometric functions sine, cosine, and tangent for user-supplied angular values. The basic program must comply with the following specification. 1. When the program is run, it is to display a short welcome message. TRIG: the trigonometric calculator 2. The program shall display a message prompting the user to enter input from the keyboard. Please input request (h-help,...