123456789101112131415161718
#include <iostream> #include <fstream> int main() { float val1, val2, val3, val4, average, add; ifstream inData; ofstream outData; inData.open("DataIn.txt"); outData.open("DataOut.txt"); inData >>val1>>val2>>val3>>val4; add=val1+val2+val3+val4; average=add/4; outData<<"Average of 4 number is: "<<average; return 0; }