How can I store this data into an array?
And I only can read the first integer.. 10.... How can I read the whole file
Heres the data:
10 alice 4/23/1972 123-45-6789 support assistant
3 bob 6/7/1980 111-12-1134 logistics manager
1 carol 10/2/1963 987-123-1143 admin ceo
2 dave 10/3/1974 902-22-8914 admin cfo
17 erin 6/13/1991 126-83-1942 technology supervisor
15 frank 2/22/1987 303-12-1122 logistics assistant
Heres what I have so far?
#include <iostream> //Accesses libaries for console input and output
#include <fstream> //Needed to access the fstream object to read files
#include <string> //Needed to access the string class
#include <cstdlib>
using namespace std; //Needed for predefinedfunction
int main(
int i, text; array [100];
fstream inputDetails; //Declares fstream object type to read file
inputDetails.open ("details.txt");
while (inputDetails >> text)
{ if (inputDetails.fail( ))
{ cout << "Input file 'details' opening failed.\n";
exit(1);
}
cout<<text<<" ";
for (i=0;i < 10 ;i++){
array[i] = text;}
}
cout<<endl;
for (int x=0;x < 10 ;x++){
cout<<array[x]<<endl;}