Here are some of the changes I have made if anyone can please help I am getting so frustrated with this it feels like I am chasing my tail on these error codes at the bottom of the program
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;
int main()
{
ofstream outputFile;
outputstream inputFile;
ofstram outputfile(Random.text);
int numbers = 0;
int running_total = running_total;
int count = 0;
int highest =1;
int lowest = 0;
int size = 0;
int x = 0;
int sum = 0;
double average = 0.0;
int lowest = numeric_limits<int>::max();
int highest = numeric_limits<int>::min();
// Openn the file.
inputFile.open("C:\\data\Random.txt")
ifstream inputFile;
int number;
inputFile.open("random.txt");
1 2 3 4 5 6 7 8 9 10
|
[code]if (!inputFile)
{
cout << "Error opening file." << endl;
}
else
{
while (inputFile >> number)
{
cout << number << endl;
}
|
inputFile.close();
}[/code]
// If the file opens successfully, process it
1 2 3 4 5 6 7 8 9 10
|
if (inputFile)
// Read the numbers from the file list and display them.
// count how man numbers where read from the file.
while (inputFile >> numbers)
{
cout << numbers << endl;
}
}
|
//If the files does not exist display a messsage file doesnot exist.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
if (inputFile)
while (inputFile >> Random. txt)
cout << "File does not exist. \n";
// The sum of all the numbers in the file (running total)
cout << "The running_total in the file ";
while (count <= runing_numbers)
cin >> numbers;
{
cin >> number;
sum += running_numbers;
}
|
// Calculate the sum of all numbers
1 2 3 4 5 6 7 8 9 10 11 12 13
|
if (numbers == 0)
while (inputFile >> numbers)
}
{
sum += numbers;
++count;
if (number < lowest) {
lowest = number;
}
if (number > highest) {
highest = number;
}
}
|
// Get the average of all numbers in the file
1 2 3 4 5 6
|
{
if (numbers > 0)
average = sum / numbers;
else get average = 0.0;
}
{
|
// Determin the lowest and the highest values in the false
1 2 3 4 5 6 7 8 9
|
highest = numbers;
if (count = 1; count < SIZE; i++)
if (numbers[count] > highest)
{
highest = numbers;
}
|
// Close the file.
inputFile.close();
return 0;
}
build errors
error C2065: 'outputstream': undeclared identifier
'outputstream': undeclared identifier
error C2146: syntax error: missing ';' before identifier 'inputFile'
error C2065: 'inputFile': undeclared identifier
error C2065: 'ofstram': undeclared identifier
error C2146: syntax error: missing ';' before identifier 'outputfile'
error C2065: 'Random': undeclared identifier
error C2228: left of '.text' must have class/struct/union
note: type is 'unknown-type'
error C3861: 'outputfile': identifier not found
error C2374: 'lowest': redefinition; multiple initialization
note: see declaration of 'lowest'
error C2374: 'highest': redefinition; multiple initialization
note: see declaration of 'highest'
error C2065: 'inputFile': undeclared identifier
error C2228: left of '.open' must have class/struct/union
note: type is 'unknown-type'
warning C4129: 'R': unrecognized character escape sequence
error C2146: syntax error: missing ';' before identifier 'ifstream'
error C2059: syntax error: 'if'
error C2143: syntax error: missing ';' before '<<'
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2059: syntax error: 'while'
error C2447: '{': missing function header (old-style formal list?)
error C2059: syntax error: 'if'
error C2143: syntax error: missing ';' before '}'
error C2059: syntax error: '}'
error C2143: syntax error: missing ';' before '{'
error C2447: '{': missing function header (old-style formal list?)
error C2447: '{': missing function header (old-style formal list?)
error C2447: '{': missing function header (old-style formal list?)