From e6d9e367d2e87ef00fddae9d3c61041d95488225 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 10 Mar 2019 16:24:04 -0500 Subject: Change \n to std::endl --- ee1301/wk4/hw4_directory/strap012_HW4A.cpp | 26 +++++++++++++------------- ee1301/wk4/hw4_directory/strap012_HW4C.cpp | 25 +++++++++++++------------ 2 files changed, 26 insertions(+), 25 deletions(-) (limited to 'ee1301/wk4/hw4_directory') diff --git a/ee1301/wk4/hw4_directory/strap012_HW4A.cpp b/ee1301/wk4/hw4_directory/strap012_HW4A.cpp index fa67e7d..abedc7a 100644 --- a/ee1301/wk4/hw4_directory/strap012_HW4A.cpp +++ b/ee1301/wk4/hw4_directory/strap012_HW4A.cpp @@ -29,31 +29,31 @@ int main () { } else if (score>80) { B++; } else if (score>70) { - C++; //Nice. + C++; } else if (score>60) { D++; } else { F++; } } - std::cout << A << " A\n" - << B << " B\n" - << C << " C\n" - << D << " D\n" - << F << " F\n"; + std::cout << A << " A" << std::endl + << B << " B" << std::endl + << C << " C" << std::endl + << D << " D" << std::endl + << F << " F" << std::endl; fin.close(); fout.open("output_files/statistics.csv"); if (!fout.is_open()) { - std::cout << "File write failed!"; + std::cout << "File write failed!\n"; return -2; } - fout << "Grade, NumStudents" - << "\nA," << A - << "\nB," << B - << "\nC," << C - << "\nD," << D - << "\nF," << F; + fout << "Grade, NumStudents" << std::endl + << "A," << A << std::endl + << "B," << B << std::endl + << "C," << C << std::endl + << "D," << D << std::endl + << "F," << F; fout.close(); } \ No newline at end of file diff --git a/ee1301/wk4/hw4_directory/strap012_HW4C.cpp b/ee1301/wk4/hw4_directory/strap012_HW4C.cpp index 7c916e3..2041150 100644 --- a/ee1301/wk4/hw4_directory/strap012_HW4C.cpp +++ b/ee1301/wk4/hw4_directory/strap012_HW4C.cpp @@ -35,6 +35,7 @@ int main() U++; } } fin.close(); + //This bit compares to see which vowel wins. if (A>E && A>I && A>O && A>U) winner = 'A'; if (E > A && E > I && E > O && E > U) @@ -46,14 +47,14 @@ int main() if (U > E && U > I && U > O && U > A) winner = 'U'; - std::cout << "The results are in!\n" - << "A/a received " << A << " votes\n" - << "E/e received " << E << " votes\n" - << "I/i received " << I << " votes\n" - << "O/o received " << O << " votes\n" - << "U/u received " << U << " votes\n" + std::cout << "The results are in!" << std::endl + << "A/a received " << A << " votes" << std::endl + << "E/e received " << E << " votes" << std::endl + << "I/i received " << I << " votes" << std::endl + << "O/o received " << O << " votes" << std::endl + << "U/u received " << U << " votes" << std::endl << "The winner is the letter \"" << winner - << "\"!\n"; + << "\"!" << std::endl; fout.open("output_files/election_results.txt"); @@ -61,10 +62,10 @@ int main() std::cout << "File write failed!\n"; return -2; } - fout << "A," << A - << "\nE," << E - << "\nI," << I - << "\nO," << O - << "\nU," << U; + fout << "A," << A << std::endl + << "E," << std::endl + << "I," << std::endl + << "O," << std::endl + << "U," << U; fout.close(); } \ No newline at end of file -- cgit v1.2.3