From 35409ace8a7d8912a1840c6aa106a40b017b9b72 Mon Sep 17 00:00:00 2001 From: kbuffardi Date: Wed, 18 Apr 2018 12:17:25 -0700 Subject: [PATCH 1/8] Buggy implementation --- main.cpp | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index a4ade7a..33d9807 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,8 @@ #include using namespace std; +int sortDescending(int, int, int); + int main() { //DO NOT CHANGE WITHIN THIS AREA... @@ -9,13 +11,36 @@ int main() cin>>red>>green>>blue; //...END OF "DO NOT CHANGE" AREA - - - + sortDescending(int red, int green, int blue); //DO NOT CHANGE WITHIN THIS AREA... cout<<"Rearranged....\n"; cout<<"RGB: "< Date: Wed, 18 Apr 2018 12:25:32 -0700 Subject: [PATCH 2/8] Add bugs in sortDescending function --- main.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 33d9807..186a59a 100644 --- a/main.cpp +++ b/main.cpp @@ -11,7 +11,7 @@ int main() cin>>red>>green>>blue; //...END OF "DO NOT CHANGE" AREA - sortDescending(int red, int green, int blue); + sortDescending(red, green, blue); //DO NOT CHANGE WITHIN THIS AREA... cout<<"Rearranged....\n"; @@ -24,17 +24,17 @@ int sortDescending(int first, int second, int third) { int temp; - if( first < second ) + if( red < green ) { temp = first; first = second; second = temp; } - if( second < third ) + if( green < blue ) { temp = second; second = third; - thired = temp; + third = temp; } if( first < second ) { @@ -43,4 +43,3 @@ int sortDescending(int first, int second, int third) second = temp; } } -} From a789325ff0e1fcc292bfba52e24206db56b492fb Mon Sep 17 00:00:00 2001 From: Kevin Buffardi Date: Tue, 19 Feb 2019 19:23:04 -0800 Subject: [PATCH 3/8] Refactored algorithm with swap and sort functions; still buggy --- .gitignore | 32 -------------------------------- Makefile | 2 ++ main.cpp | 54 ++++++++++++++++++++++++++---------------------------- 3 files changed, 28 insertions(+), 60 deletions(-) delete mode 100644 .gitignore create mode 100644 Makefile diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 259148f..0000000 --- a/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -# Prerequisites -*.d - -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8d03a55 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +all: + g++ -Wfatal-errors main.cpp diff --git a/main.cpp b/main.cpp index 186a59a..e4f9ae8 100644 --- a/main.cpp +++ b/main.cpp @@ -1,45 +1,43 @@ #include -using namespace std; +using std::cout; +using std::cin; +using std::endl; -int sortDescending(int, int, int); +void sortDescending(int,int,int); +void swap(int&,int&); int main() { - //DO NOT CHANGE WITHIN THIS AREA... - int red, blue, green; - cout<<"Enter Red, Green, and Blue values: "; - cin>>red>>green>>blue; - //...END OF "DO NOT CHANGE" AREA + int numA, numB, numC; + cout<<"Enter any three numbers: "; + cin>>numA>>numB>>numC; - sortDescending(red, green, blue); - - //DO NOT CHANGE WITHIN THIS AREA... - cout<<"Rearranged....\n"; - cout<<"RGB: "< Date: Tue, 19 Feb 2019 19:34:58 -0800 Subject: [PATCH 4/8] Adds basic getting started documentation --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..78ed664 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Trio + +This C++ program receives three integers and tells the user the numbers in descending (largest-to-smallest) order. + +## Getting Started + +To run the program do the following in your command line interface prompt ($): + +``` +$make +$./a.out +``` From 65cdfbb3866ede2124941d2ad80e0cbb8eaea367 Mon Sep 17 00:00:00 2001 From: Kylee B Rasmussen Date: Wed, 20 Feb 2019 11:24:25 -0800 Subject: [PATCH 5/8] the users numbers now print in descending order, fixed #2 --- main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index e4f9ae8..14a4bbf 100644 --- a/main.cpp +++ b/main.cpp @@ -3,23 +3,31 @@ using std::cout; using std::cin; using std::endl; -void sortDescending(int,int,int); +void sortDescending(int&,int&,int&); void swap(int&,int&); int main() { + //Takes user input and stores in int variables int numA, numB, numC; cout<<"Enter any three numbers: "; cin>>numA>>numB>>numC; + //Number sorting Function sortDescending(numA, numB, numC); + + //Outputs sorted numbers to the user cout<<"From greatest to least, they are: "; cout< Date: Wed, 20 Feb 2019 11:28:06 -0800 Subject: [PATCH 6/8] travis CI build script --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..58cd46d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: cpp +os: linux +script: + - make From 7feaae21d7b0ee0cf0d903c8dbc38c12a7388fb9 Mon Sep 17 00:00:00 2001 From: krasmussen3 <47172688+krasmussen3@users.noreply.github.com> Date: Wed, 20 Feb 2019 11:32:28 -0800 Subject: [PATCH 7/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 78ed664..b7135d1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Build Status](https://travis-ci.com/krasmussen3/Trio.svg?branch=master)](https://travis-ci.com/krasmussen3/Trio) # Trio This C++ program receives three integers and tells the user the numbers in descending (largest-to-smallest) order. From fd1de76acf845a16f02f4c1e2b8716e3a50ac08a Mon Sep 17 00:00:00 2001 From: krasmussen3 <47172688+krasmussen3@users.noreply.github.com> Date: Wed, 20 Feb 2019 12:19:38 -0800 Subject: [PATCH 8/8] Update main.cpp --- main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/main.cpp b/main.cpp index b9c0ea2..3f57bb3 100644 --- a/main.cpp +++ b/main.cpp @@ -54,4 +54,3 @@ void swap(int &first, int &second) second = temp; } //...END OF "DO NOT CHANGE" AREA -}