Skip to main content
Code Review

Return to Question

deleted 11 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Using file stream object, write a program to read an external text file ("myCourse.txt") which contains all the course name and numbers you are taking this semester, and to generate an analysis (total number of courses) into an external file ("myCourseSummay.txt").

Using file stream object, write a program to read an external text file ("myCourse.txt") which contains all the course name and numbers you are taking this semester, and to generate an analysis (total number of courses) into an external file ("myCourseSummay.txt").

This is a past question my teacher has been hinting at us to practice, so my friend &and I made this and wanted to know if would be acceptable? ok or nah?

personally i. Personally, I think we messed the writing to the txt.txt file.

#include <iostream>
#include <fstream>
#include<string>
using namespace std;
int intro()
{
 cout << "Hello World!";
 return 0;
}
int main()
{
 ofstream myCourse;
 myCourse.open("myCourse.txt");
 char course1[20], course2[20], course3[20], course4[20];
 
 cout << "Enter number of courses. max of 4" << endl;
 cout << "Enter 1st course: ";
 cin >> course1;
 myCourse << course1 << endl;
 cout << "Enter 2nd course: ";
 cin >> course2;
 myCourse << course2 << endl;
 cout << "Enter 3rd course: ";
 cin >> course3;
 myCourse << course3 << endl;
 cout << "Enter 4th course: ";
 cin >> course4;
 myCourse << course4 << endl;
 
 myCourse.close();
 
 ifstream myCourseSummary;
 string word;
 int count = 0;
 myCourseSummary.open("myCourseSummary.txt");
 
 while(!myCourseSummary.eof())
 {
 myCourseSummary >> word;
 count++;
 }
 
 cout << "Total number if courses is(are) " << count << "!";
 myCourseSummary.close();
 
 cin.get();
 return 0;
}

Using file stream object, write a program to read an external text file ("myCourse.txt") which contains all the course name and numbers you are taking this semester, and to generate an analysis (total number of courses) into an external file ("myCourseSummay.txt").

This is a past question my teacher has been hinting at us to practice, so my friend & I made this and wanted to know if be acceptable? ok or nah?

personally i think we messed the writing to the txt file.

#include <iostream>
#include <fstream>
#include<string>
using namespace std;
int intro()
{
 cout << "Hello World!";
 return 0;
}
int main()
{
 ofstream myCourse;
 myCourse.open("myCourse.txt");
 char course1[20], course2[20], course3[20], course4[20];
 
 cout << "Enter number of courses. max of 4" << endl;
 cout << "Enter 1st course: ";
 cin >> course1;
 myCourse << course1 << endl;
 cout << "Enter 2nd course: ";
 cin >> course2;
 myCourse << course2 << endl;
 cout << "Enter 3rd course: ";
 cin >> course3;
 myCourse << course3 << endl;
 cout << "Enter 4th course: ";
 cin >> course4;
 myCourse << course4 << endl;
 
 myCourse.close();
 
 ifstream myCourseSummary;
 string word;
 int count = 0;
 myCourseSummary.open("myCourseSummary.txt");
 
 while(!myCourseSummary.eof())
 {
 myCourseSummary >> word;
 count++;
 }
 
 cout << "Total number if courses is(are) " << count << "!";
 myCourseSummary.close();
 
 cin.get();
 return 0;
}

Using file stream object, write a program to read an external text file ("myCourse.txt") which contains all the course name and numbers you are taking this semester, and to generate an analysis (total number of courses) into an external file ("myCourseSummay.txt").

This is a past question my teacher has been hinting at us to practice, so my friend and I made this and wanted to know if would be acceptable. Personally, I think we messed the writing to the .txt file.

#include <iostream>
#include <fstream>
#include<string>
using namespace std;
int intro()
{
 cout << "Hello World!";
 return 0;
}
int main()
{
 ofstream myCourse;
 myCourse.open("myCourse.txt");
 char course1[20], course2[20], course3[20], course4[20];
 
 cout << "Enter number of courses. max of 4" << endl;
 cout << "Enter 1st course: ";
 cin >> course1;
 myCourse << course1 << endl;
 cout << "Enter 2nd course: ";
 cin >> course2;
 myCourse << course2 << endl;
 cout << "Enter 3rd course: ";
 cin >> course3;
 myCourse << course3 << endl;
 cout << "Enter 4th course: ";
 cin >> course4;
 myCourse << course4 << endl;
 
 myCourse.close();
 
 ifstream myCourseSummary;
 string word;
 int count = 0;
 myCourseSummary.open("myCourseSummary.txt");
 
 while(!myCourseSummary.eof())
 {
 myCourseSummary >> word;
 count++;
 }
 
 cout << "Total number if courses is(are) " << count << "!";
 myCourseSummary.close();
 
 cin.get();
 return 0;
}
Tweeted twitter.com/StackCodeReview/status/659059860848406528
edited tags
Link
200_success
  • 145.6k
  • 22
  • 190
  • 479
corrected use of markdown codeblock-marking
Source Link
Deduplicator
  • 19.9k
  • 1
  • 32
  • 65

Using file stream object, write a program to read an external text file ("myCourse.txt") which contains all the course name and numbers you are taking this semester, and to generate an analysis (total number of courses) into an external file ("myCourseSummay.txt").

This is a past question my teacher has been hinting at us to practice, so my friend & I made this and wanted to know if be acceptable? ok or nah?

personally i think we messed the writing to the txt file.

#include <iostream>
#include <fstream>
#include<string>
using namespace std;
int intro()
{
cout << "Hello World!";
return 0;
}
int main()
{
ofstream myCourse;
myCourse.open("myCourse.txt");
char course1[20], course2[20], course3[20], course4[20];

cout << "Enter number of courses. max of 4" << endl;
cout << "Enter 1st course: ";
cin >> course1;
myCourse << course1 << endl;
cout << "Enter 2nd course: ";
cin >> course2;
myCourse << course2 << endl;
cout << "Enter 3rd course: ";
cin >> course3;
myCourse << course3 << endl;
cout << "Enter 4th course: ";
cin >> course4;
myCourse << course4 << endl;

myCourse.close();

ifstream myCourseSummary;
string word;
int count = 0;
myCourseSummary.open("myCourseSummary.txt");

while(!myCourseSummary.eof())
{
 myCourseSummary >> word;
 count++;
}

cout << "Total number if courses is(are) " << count << "!";
myCourseSummary.close();

cin.get();
return 0;
}

}

Using file stream object, write a program to read an external text file ("myCourse.txt") which contains all the course name and numbers you are taking this semester, and to generate an analysis (total number of courses) into an external file ("myCourseSummay.txt").

This is a past question my teacher has been hinting at us to practice, so my friend & I made this and wanted to know if be acceptable? ok or nah?

personally i think we messed the writing to the txt file.

#include <iostream>
#include <fstream>
#include<string>
using namespace std;
int intro()
{
cout << "Hello World!";
return 0;
}
int main()
{
ofstream myCourse;
myCourse.open("myCourse.txt");
char course1[20], course2[20], course3[20], course4[20];
cout << "Enter number of courses. max of 4" << endl;
cout << "Enter 1st course: ";
cin >> course1;
myCourse << course1 << endl;
cout << "Enter 2nd course: ";
cin >> course2;
myCourse << course2 << endl;
cout << "Enter 3rd course: ";
cin >> course3;
myCourse << course3 << endl;
cout << "Enter 4th course: ";
cin >> course4;
myCourse << course4 << endl;
myCourse.close();
ifstream myCourseSummary;
string word;
int count = 0;
myCourseSummary.open("myCourseSummary.txt");
while(!myCourseSummary.eof())
{
 myCourseSummary >> word;
 count++;
}
cout << "Total number if courses is(are) " << count << "!";
myCourseSummary.close();
cin.get();
return 0;

}

Using file stream object, write a program to read an external text file ("myCourse.txt") which contains all the course name and numbers you are taking this semester, and to generate an analysis (total number of courses) into an external file ("myCourseSummay.txt").

This is a past question my teacher has been hinting at us to practice, so my friend & I made this and wanted to know if be acceptable? ok or nah?

personally i think we messed the writing to the txt file.

#include <iostream>
#include <fstream>
#include<string>
using namespace std;
int intro()
{
cout << "Hello World!";
return 0;
}
int main()
{
ofstream myCourse;
myCourse.open("myCourse.txt");
char course1[20], course2[20], course3[20], course4[20];

cout << "Enter number of courses. max of 4" << endl;
cout << "Enter 1st course: ";
cin >> course1;
myCourse << course1 << endl;
cout << "Enter 2nd course: ";
cin >> course2;
myCourse << course2 << endl;
cout << "Enter 3rd course: ";
cin >> course3;
myCourse << course3 << endl;
cout << "Enter 4th course: ";
cin >> course4;
myCourse << course4 << endl;

myCourse.close();

ifstream myCourseSummary;
string word;
int count = 0;
myCourseSummary.open("myCourseSummary.txt");

while(!myCourseSummary.eof())
{
 myCourseSummary >> word;
 count++;
}

cout << "Total number if courses is(are) " << count << "!";
myCourseSummary.close();

cin.get();
return 0;
}
added 71 characters in body
Source Link
David
  • 61
  • 1
  • 1
  • 3
Loading
Source Link
David
  • 61
  • 1
  • 1
  • 3
Loading
lang-cpp

AltStyle によって変換されたページ (->オリジナル) /