If I have a file with this data: 14323 Item 56 13.76 12876 AnotherItem 43 19.87
ID: 3615488 • Letter: I
Question
If I have a file with this data: 14323 Item 56 13.76 12876 AnotherItem 43 19.87 how do I read that file into a program putting. 14323 into an integer variable Item into a characterarray that can only read the first 12 letters of a word 56 into another integer variable 13.76 into a double variable So that I can use those 4 variables in the program, thenreplace them with the data from the 2nd line of the file. Ifyou have any questions just send me a message. If I have a file with this data: 14323 Item 56 13.76 12876 AnotherItem 43 19.87 12876 AnotherItem 43 19.87 how do I read that file into a program putting. 14323 into an integer variable Item into a characterarray that can only read the first 12 letters of a word 56 into another integer variable 13.76 into a double variable So that I can use those 4 variables in the program, thenreplace them with the data from the 2nd line of the file. Ifyou have any questions just send me a message.Explanation / Answer
please rate-thanks #include #include using namespace std; int main() {char filename[30]; int id,num,i; char word[50]; double real; coutfilename; ifstream in; in.open(filename); //open file if(in.fail()) //is it ok? { coutid; while(in) {in>>word; word[12]=''; for(i=0;i>num>>real; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.