Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Reading in multiple files, displaying them (arrays and vectors) and me

sgarasgara Member Posts: 5
1) I am having problems in figuring out exactly how to display the Sets from the separate files I have set up. I have 4 files : Set1A, Set1B, etc. I need to find out how to read in information from Multiple files correctly a desired horizontal fashion for the "cout' display. Same problem exists in reading in multiple files for vectors.

Code is below for reading in files (the arrays or vectors) and then merging them. I need to find out what I'm doing wrong. Thanks.


//Setting up the functions and arguments

#include
#include
#include
//#include
//using namespace std;

//Number of integers in the arrays is 11, so set it;

const int ARRAYSET_SIZE=11;

//Function Prototypes declared - includes Vectors


void DisplayHeader(int);
void DisplayArray(int [], int);
//void Sort(int [], int);
void MergeArray(int [], int, int[], int);

//void ShowVectorHeader(int);
//void ShowVector(vector);
//void StartVectors (vector, vector);

//**************************************************************

//Main

void main(void)

//Read the Arrays from file:

{
ifstream infile;
int count;

infile.open("C:\Documents and Settings\Steve\Desktop\Set1A.txt");
infile.open("C:\Documents and Settings\Steve\Desktop\Set1B.txt");
infile.open("C:\Documents and Settings\Steve\Desktop\Set2A.txt");
infile.open("C:\Documents and Settings\Steve\Desktop\Set2B.txt");

int count= 0;

{

for (int count=0; count<=11; count++)

{
infile>>Set1A[count];
infile>>Set1B[count];
infile>>Set2A[count];
infile>>Set2B[count];

//Want to display the arrays separately here
//1A and 1B, then 2A and 2B the second time it is run.

infile.close();
}


//**************************************************************

//Merge Arrays together

void MergeArray (int xBeginArray[], int xBeginArrSize, int iEndArray[], int iEndArrSize)

{
for (int iCount=0; iCount<xBeginArrSize; iCount++)

{
iEndArray[iEndArrSize+iCount] = iEndArray[iCount];
}
}


Comments

  • Justin BibJustin Bib USAMember Posts: 0

    _ ( http://forcoder.org ) free video tutorials and ebooks about || Assembly MATLAB C# PL/SQL Go C Ruby JavaScript Objective-C PHP R Python Visual Basic .NET C++ Delphi Scratch Perl Visual Basic Java Swift Erlang Dart SAS ABAP Ada ML Lisp Fortran Lua Prolog Logo Crystal D Scheme Bash Apex Julia F# COBOL VBScript LabVIEW Alice Rust Awk Kotlin Scala FoxPro Transact-SQL Clojure Hack || _____

Sign In or Register to comment.