heey guys.. i have this h.w.. i solved the first part which is based on the second part.. but not sure whether i did it right or not.. can someone check plz..

this is the Q.. i only did the first part!

First create a one dimensional array called numbers that contains the following data
(Initialize the array with the numbers listed below).
6,7,-3,-4,5,-5,10
Output the array data to a file called data.txt.
==============================================
Then:
1) Calculate how many items are there in the file.
2) Calculates the number of the positive numbers and negative numbers
3) Calculate the sum of the positive numbers only.
4) Get a target from the user to search for; e.g. 7 (as an input from the screen)
5) Sort the array’s elements in ascending order and follow exactly the file snapshot next page.
6) Then append the result of 1) to 5) to the same file.

==============================================
now i created the input file and added the numbers to it.. but after running the program.. the numbers didn't appear in the output file.. dunnu why.. is smthn wrong with my code?

#include <iostream>
#include <cstdlib>
#include <fstream>

using namespace std;

int main ()
{

int NUMBERS [7] = {6,7,-3,-4,5,-5,10};

//declare file:
ofstream data_out;

//initialize file:
data_out.open ("data.txt");

//check file:

if (data_out.fail())
cout<<"Exit data";

//use file:

for (int i=0;i>=6;i++)
{
data_out<<NUMBERS [i];
}

//close file:
data_out.close ();

return 0;

}

## Sky Diploma 571

Firstly from the question arent you supposed to read from "data.txt" and not "read_data.txt"

Secondly. I am quiet confused with your code.

You should first post all the Numbers into the file and then read in from the file again to perform math calculations ?

i dunnu.. i did from both.. but didn't work..
Is something wrong with my code?? i don't know

## ArkM 1,090

Let's start from the real code...
See for loop condition: i >= 6 . In other words, while i is greater than or equal to 6. The initial i value is 0...

## Sky Diploma 571

This code confuses me . I donot understand whether read_data.txt has numbers in it or According to the problem statement. The file must be filled.