mirror of
https://bitbucket.org/Mattrixwv/my-classes.git
synced 2025-12-06 18:23:57 -05:00
Updated comments
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
//myClasses/headers/mee/stringAlgorithms.hpp
|
//myClasses/headers/mee/stringAlgorithms.hpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 07-02-21
|
// Created: 07-02-21
|
||||||
//Modified: 07-02-21
|
//Modified: 10-11-21
|
||||||
//This file contains declarations of functions I have created to manipulate strings
|
//This file contains declarations of functions I have created to manipulate strings
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2021 Matthew Ellison
|
Copyright (C) 2021 Matthew Ellison
|
||||||
@@ -112,6 +112,11 @@ bool isPalindrome(std::string str){
|
|||||||
|
|
||||||
//This function returns true if the string passed to it is a pandigital
|
//This function returns true if the string passed to it is a pandigital
|
||||||
bool isPandigital(std::string str, char bottom, char top){
|
bool isPandigital(std::string str, char bottom, char top){
|
||||||
|
//Return false if top < bottom
|
||||||
|
if(top < bottom){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//Return false if the wrong number of characters are in the string
|
//Return false if the wrong number of characters are in the string
|
||||||
if(str.size() != (top - bottom + 1)){
|
if(str.size() != (top - bottom + 1)){
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//myClasses/test/mee/testStringAlgorithms.cpp
|
//myClasses/test/mee/testStringAlgorithms.cpp
|
||||||
//Matthew Ellison
|
//Matthew Ellison
|
||||||
// Created: 07-02-21
|
// Created: 07-02-21
|
||||||
//Modified: 07-02-21
|
//Modified: 10-11-21
|
||||||
//This file contains tests for the functions in my stringAlgorithms library
|
//This file contains tests for the functions in my stringAlgorithms library
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2021 Matthew Ellison
|
Copyright (C) 2021 Matthew Ellison
|
||||||
@@ -188,6 +188,14 @@ bool testIsPandigital(){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Test 4
|
||||||
|
num = "123";
|
||||||
|
correctAnswer = false;
|
||||||
|
answer = mee::isPandigital(num, '3', '1');
|
||||||
|
if(correctAnswer != answer){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//If it hasn't failed a test then return true for passing all the tests
|
//If it hasn't failed a test then return true for passing all the tests
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user