write a program that will read a file containing floating point numbers, store the numbers into an array, count how many numbers were in the file, then output the numbers in reverse order. Your program should only use one array and that array should not be changed after the numbers have been read. You should assume that the file does not contain more than 100 floating point numbers.
Numbers found in file
100.7362
105.2896
66.3493
105.6688
91.6180
64.8770
73.9249
87.3441
107.8753
108.2444
67.8807
108.5296
107.8583
84.2688
100.0140
67.0943
81.0881
105.7868
99.6104
107.9746
92.7870
61.7856
102.4565
106.6997
93.9368
97.8870
97.1566
79.6114
92.7739
68.5593
95.3023
61.5916
73.8461
62.3086
64.8566
101.1729
94.7414
75.8550
107.5111
61.7223
81.9372
79.0779
98.2758
99.7600
69.3436
84.4882
82.2793
92.3157
95.4682
97.7343
73.8013
93.9851
92.7549
68.1306
65.9499
84.9182
107.9872
77.0193
89.2634
71.1906
97.5634
72.7548
85.2979
94.9538
104.5452
107.9646
87.3608
66.9312
67.4647
72.8754
102.0359
72.7141
100.7142
72.1762
106.4632
77.4992
69.8298
72.5542
90.8022
83.6644
77.5830
HI, Please find my code.
Please let me know in case of any issue.
#include <iostream>
#include <fstream>
using namespace std;
int main(){
string filename; // to store input file name
ifstream inFile; // input stream
cout<<"Enter input file name: ";
cin>>filename;
// opening file
inFile.open(filename.c_str());
// file opening error check
if(inFile.fail()){
cout<<"Error in file
opening"<<endl;
return -1;
}
//declaring a double array of size 100
double data[100];
int i = 0; // counter
double number;
// reading number one by one
while(inFile>>number){
// storing in array
data[i++] = number;
}
// closing file
inFile.close();
// displaying in reverse order
for(int j=i-1; j>=0; j--){
cout<<data[j]<<"
";
}
cout<<endl;
return 0;
}
write a program that will read a file containing floating point numbers, store the numbers into...
Arrays and reading from a file USE C++ to write a program that will read a file containing floating point numbers, store the numbers into an array, count how many numbers were in the file, then output the numbers in reverse order. The program should only use one array and that array should not be changed after the numbers have been read. You should assume that the file does not contain more than 100 floating point numbers. The file name...
This is a C programming question. We have a file containing floating point numbers (we don't know how many). Write a complete C program that alternately averages only the floating point numbers (for example 3.50, 12.507, 123.60,5.98 would lead to the result (12.507+5.98)/2), ignore the whole numbers. Use file input, assuming the file is named "numbers.data". The program should be compatible with files that contain several numbers on separate lines.
Write a C PROGRAM that will read in 10 floating-point numbers from the keyboard and load them into an array. Add up all the values and store the answer in a variable. Find the largest and smallest number in the array. Put each into its own variable. Print to the screen the sum, largest value, and smallest value. Copy the array to a second array in reverse order. Print out the second array. Read in 20 integer numbers, all in...
c++ no pointers just follow instructions Write a program (array.cpp) that read positive floating point numbers into an array of capacity 100. The program will then ask for one of three letters(A, M or S). if the user inputs something other than one of these letters, then the program should ask for that input until an A, M, or S is entered. A do-while loop should be used for this. If the user inputs an A, then the program should...
Write a program that takes an operation (+, -, /, or *) and two floating-point numbers, and outputs the result of applying that operation to the two numbers. For example, if the input is: + 100 3.14 the output should be 100 + 3.14 = 103.14 Likewise, if the input is * 4 5 the output should be 4 * 5 = 20 You may assume the input is well-formed; that is, the first string is one of the four...
WRITE A PROGRAM IN C THAT DOES THE FOLLOWING: The numbers are real numbers, read in as double precision floating-point numbers, one number perline, possibly with some white space before or after. Hint: use scanf. There are guaranteed to be no more than one million (that’s 10^6) numbers in the input, and no fewer than two legitimate numbers. Any number that is equal to zero should be ignored (discarded, not stored in the array or counted in any way).
This program has an array of floating point numbers as a private data member of a class. The data file contains floating point temperatures which are read by a member function of the class and stored in the array. Exercise 1: Why does the member function printList have a const after its name but getList does not? Exercise 2: Fill in the code so that the program reads in the data values from the temperature file and prints them to...
Write a python program and pseudocode The Program Using Windows Notepad (or similar program), create a file called Numbers.txt in your the same folder as your Python program. This file should contain a list on floating point numbers, one on each line. The number should be greater than zero but less than one million. Your program should read the following and display: The number of numbers in the file (i.e. count them) (counter) The maximum number in the file (maximum)...
Write a java program to read from a file “input4_02.txt” an integer N (0? N ? 100) and then read N double numbers from this file to an array. Write to file “output4_02.txt” this array but in the reverse order and also the sum of all elements in the array. For example File: “input4_02.txt” 5 1.30 2.22 4.00 17.60 3.14 File “output4_02.txt” 3.14 17.60 4.00 2.22 1.30 Sum = 28.26
Write a program **(IN C)** that displays all the phone numbers in a file that match the area code that the user is searching for. The program prompts the user to enter the phone number and the name of a file. The program writes the matching phone numbers to the output file. For example, Enter the file name: phone_numbers.txt Enter the area code: 813 Output: encoded words are written to file: 813_phone_numbers.txt The program reads the content of the file...