This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "summation.h" | |
| #include <iostream> | |
| using namespace std; | |
| double sum(double array[], int size); // Function prototype | |
| int main() | |
| { | |
| const int SIZE = 6; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef SUMMATION_HPP | |
| #define SUMMATION_HPP | |
| double sum(double array[], int size); | |
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "summation.h" | |
| double sum(double arr[], int size) | |
| { | |
| double total = 0.0; // accumulator | |
| for(i = 0; i < size, i++) | |
| total += array[i]; | |
| return total; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "Patron.hpp" | |
| #include <string> | |
| Patron::Patron(std::string idn, std::string n) // constructor that takes a Patron idNum and name | |
| { | |
| idNum = idn; | |
| name = n; | |
| } | |
| std::string Patron::getIdNum() // get and return the Patron's idNum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "Book.hpp" | |
| #include <string> | |
| Book::Book(std::string idc, std::string t, std::string a) // takes an idCode, title and author; | |
| { // checkedOutBy and requestedBy should be | |
| idCode = idc; // initialized to NULL; a new Book should be | |
| title = t; // on the shelf | |
| author = a; | |
| setLocation(ON_SHELF); | |
| setCheckedOutBy(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool stringIsInt(string string) | |
| for (int i = 0; i < string.length(); i++) | |
| { | |
| if(string.at(i) == "+" || string.at(i) == "-" || string.at(i) = " ") | |
| { | |
| for(int j=i; j<string.length(); j++) | |
| { | |
| if(isspace(string.at(j))) | |
| valid = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool stringIsInt(string string) | |
| { | |
| bool valid = true; | |
| for (int i = 0; i < string.length(); i++) | |
| { | |
| if(string.at(i) == "+" || string.at(i) == "-" || string.at(i) = " ") | |
| { | |
| for(int j=i; j<string.length(); j++) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool stringIsInt(string string) | |
| for (int i = 0; i < string.length(); i++) | |
| { | |
| if(string.at(i) == "+" || string.at(i) == "-" || string.at(i) = " ") | |
| { | |
| for(int j=i; j<string.length(); j++) | |
| { | |
| if(isspace(string.at(j))) | |
| valid = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void findMode(int array[], int size); // Function Prototype | |
| int main () { | |
| const int SIZE = 10; | |
| int array[SIZE] = {1, 2, 2, 2, 3, 4, 4, 5, 5, 6}; | |
| findMode(array, SIZE); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void findMode(int array[], int size); // Function Prototype | |
| int main () { | |
| const int SIZE = 10; | |
| int array[SIZE] = {1, 2, 2, 2, 3, 4, 4, 5, 5, 6}; | |
| findMode(array, SIZE); | |
| return 0; | |
| } |
NewerOlder