Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program called p1.cpp that defines three integer variables, and initializes them with three different values. It should then output the values of the

  1. Write a program called p1.cpp that defines three integer variables, and initializes them with three different values. It should then output the values of the three variables, their sum, and their average. (Hint: Use printf.)
  2. Write a program called p2.cpp that prompts the user for three integer variables. It should then output the values of the three variables, their sum, and their average. (Hint: Use printf and scanf.)
  3. Write a program called p3.cpp that reads in three integer variables from an ordinary ASCII text file. It should then output the values of the three variables, their sum, and their average. (Note: You must use fscanf, and you must handle the cases (simply using asserts) when (i) the file doesn't exist, and (ii) there are less than 3 ints in the file.)
  4. all written in c

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions