I want to make a program that reads the text file below, and stores each column
ID: 3532496 • Letter: I
Question
I want to make a program that reads the text file below, and stores each column into a seperate array so that I may use it for functions and what not. Please DONT USE CLASSES or HEADERS. I need to use arrays NOT VECTORS. I am sorry for the emphasis but I have asked this before and people just want to tell me the "best" way of doing it. Not following the instructions. The file below has 5 elements to it each seperated by a space bar.
int << string << int << double << double
Thank you for the help.
4101 BRAEBURN_REG 1 0.99 101.5
4021 DELICIOUS_GDN_REG 1 0.89 94.2
4020 DELICIOUS_GLDN_LG 1 1.09 84.2
4015 DELICIOUS_RED_REG 1 1.19 75.3
4016 DELICIOUS_RED_LG 1 1.29 45.6
4167 DELICIOUS_RED_SM 1 0.89 35.4
4124 EMPIRE 1 1.14 145.2
4129 FUJI_REG 1 1.05 154.5
4131 FUJI_X-LGE 1 1.25 164.1
4135 GALA_LGE 1 1.35 187.7
4133 GALA_REG 1 1.45 145.2
4139 GRANNY_SMITH_REG 1 1.39 198.2
4017 GRANNY_SMITH_LGE 1 1.49 176.5
3115 PEACHES 1 2.09 145.5
4011 BANANAS 1 0.49 123.2
4383 MINNEOLAS 1 0.79 187.3
3144 TANGERINES 1 1.19 135.5
4028 STRAWBERRIES_PINT 0 0.99 104
4252 STRAWBERRIES_HALF_CASE 0 3.99 53
4249 STRAWBERRIES_FULL_CASE 0 7.49 67
94011 ORGANIC_BANANAS 1 0.99 56.3
Explanation / Answer
#include<iostream.h>
#include <string.h>
void main()
{
int A1[100];
String A2[100];
int A3[100];
double A4[100];
double A5[100];
int i=0;
while(1==1)
{
cin <<A1[i];
cin <<A2[i];
cin <<A3[i];
cin <<A4[i];
cin <<A5[i];
i++;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.