C++ Write a program that prompts the user to enter 3 integers. These 3 integers
ID: 640185 • Letter: C
Question
C++
Write a program that prompts the user to enter 3 integers. These 3 integers should be the numbers that represent the capital letters of your First and Last Name and your middle initial. The program accepts the numbers and then prints the numbers as characters. If you do not have a middle name, produce a character that has not been used by your first or last name. The program should next print the 2 numbers as integers. The program should next print the numbers as floating point values with 3 decimal places. Last, the program should print a statement that defines the acronym ASCII.
(First initial: A, Last initial: O, No middle)
use main (void), printf, scanf, if needed.
do not use cout.
sample output:
Enter the first and second integer: xxxx xxxx
Enter the third integer on the next line: xxxx
Results: The first and second numbers as characters are my initials: xxxx and xxxx.
My middle initial is: xxxxx
The numbers as integers are: xxxx and xxxx.
Observation: xxxx and xxxx are the numbers in a decimal format.
The (student
Explanation / Answer
#include <stdio.h>
#include<iostream>
using namespace std;
//Program begins with a main function
void main()
{
//Declare variables
int first, second, third;
//Prompt and read integers from the user
printf("Enter the first and second integers: ");
scanf("%d%d", &first, &second);
printf("Enter the third integer on the next line: ");
scanf("%d", &third);
// program accepts the numbers and then prints the numbers as characters
printf("The first and second numbers as characters are my initials: %c and %c ", first, second);
printf("My middle initial is: %c ", third);
printf("The numbers as integers are: %d and %d ", first, second);
printf("Observation: %.3f and %.3f are the numbers in a decimal format. ", (float)first, (float)second);
printf("American Standard Code for Information Interchange(ASCII) ");
//Pause the system for a while
system("PAUSE");
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.