Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .gitignore

This file was deleted.

4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: cpp
os: linux
script:
- make
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all:
g++ -Wfatal-errors main.cpp
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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 ($):

[![Build Status](https://travis-ci.com/cdivoky/Trio.svg?branch=master)](https://travis-ci.com/cdivoky/Trio)

```
$make
$./a.out
```
Binary file added a.exe
Binary file not shown.
48 changes: 36 additions & 12 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@
#include <iostream>
using namespace std;
using std::cout;
using std::cin;
using std::endl;


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(numA, numB, numC);

cout<<"From greatest to least, they are: ";
cout<<numA<<","<<numB<<","<<numC<<endl;
return 0;
}

void sortDescending(int first, int second, int third)
{
if( first < third )
{
swap(first,third);
}
if( first < second )
{
swap(first,second);
}
if( second < third )
{
swap(second,third);
}
}

void swap(int &first, int &second)
{
int temp = first;
first = second;
second = temp;
}

//DO NOT CHANGE WITHIN THIS AREA...
cout<<"Rearranged....\n";
cout<<"RGB: "<<red<<","<<green<<","<<blue<<endl;
return 0;
//...END OF "DO NOT CHANGE" AREA
}