diff options
author | RossTheRoss <msattr@gmail.com> | 2019-03-10 16:24:04 -0500 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-03-10 16:24:04 -0500 |
commit | e6d9e367d2e87ef00fddae9d3c61041d95488225 (patch) | |
tree | c5e51f6f3c57086a0781162aa84295aa3eb66728 | |
parent | C O M M E N T S (diff) | |
download | homework-e6d9e367d2e87ef00fddae9d3c61041d95488225.tar homework-e6d9e367d2e87ef00fddae9d3c61041d95488225.tar.gz homework-e6d9e367d2e87ef00fddae9d3c61041d95488225.tar.bz2 homework-e6d9e367d2e87ef00fddae9d3c61041d95488225.tar.lz homework-e6d9e367d2e87ef00fddae9d3c61041d95488225.tar.xz homework-e6d9e367d2e87ef00fddae9d3c61041d95488225.tar.zst homework-e6d9e367d2e87ef00fddae9d3c61041d95488225.zip |
Change \n to std::endl
-rw-r--r-- | ee1301/wk4/hw4_directory/strap012_HW4A.cpp | 26 | ||||
-rw-r--r-- | ee1301/wk4/hw4_directory/strap012_HW4C.cpp | 25 | ||||
-rw-r--r-- | output_files/election_results.txt | 6 |
3 files changed, 29 insertions, 28 deletions
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 diff --git a/output_files/election_results.txt b/output_files/election_results.txt index 418db83..33b070e 100644 --- a/output_files/election_results.txt +++ b/output_files/election_results.txt @@ -1,5 +1,5 @@ A,227 -E,315 -I,330 -O,129 +E, +I, +O, U,268
\ No newline at end of file |