Need Help. 2-Dimensional Array?

I am stuck trying to write a program that,
1. Calls a function that reads from names.txt, the names of the two other files.
2. A function that reads the set of integers one at a time until you reach the end of the file. Note: You do not know the number of integers ahead of time.
3. A function that squares each integer and then writes the integer square pair to answers.txt.

This is what i have so far...


#include <iostream>

#include <fstream>

#include <cstdlib>

using namespace std;

void read_names(char data[], char answers[]); //names of the other two files

void get_data(char data[], char answers[]); // list of 6 integer numbers

void write_answers(int a, char answers[]); // repository for the program to receive original number followed by the square of the number

int main()
{
char data[32], answers[32];
read_names(data, answers);
cout << data << " " << answers<<endl;
get_data(data, answers);
}
void read_names(char data[], char answers[])
{
ifstream namesin;
namesin.open("names.txt");
//missing info
}
void get_data(char data[], char answers[])
{
int a;
ifstream datain;
datain.open(data);
//missing info
}
void write_answers(int a, char answers[])
{
ofstream outanswers;
outanswers.open(answers, ios::app);
//missing info
}
Topic archived. No new replies allowed.