Dec 4, 2016 at 11:44pm UTC
I need help with this code,,,
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
string reverseString(string i)
{
string r = 0;
string rev = 0;
}
bool isVowel(char c)
{
}
bool isPunctuationMark(char c)
{
}
int main ()
{
cout << "Enter a string: \n";
string string;
getline(cin, string);
cout << "You entered: " << string << endl;
cout << " " << endl;
// your program is to read in a string (including spaces);
// cout << digits, letters (uppercase and lowercase), spaces, vowels, punctuation, others
// show a reverse string
//(dont overwrite original string)
return 0;
}
please help thanks
Dec 4, 2016 at 11:45pm UTC
***
Write a program that requests the user to enter a string that includes a combination of letters
(uppercase or lower), digits, spaces, punctuation marks and/or any other keyboard symbols.
Dec 5, 2016 at 6:05am UTC
http://www.cplusplus.com/forum/general/203952/
Dec 5, 2016 at 8:12am UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
std::string reverse(const std::string &s)
{
return std::string(s.crbegin(), s.crend());
}
bool isVowel(char c)
{
const std::string vowels = "aAeEiIoOuU" ;
return vowels.find(c) != std::string::npos;
}
bool isPunct(char c)
{
const std::string punct = "+=%₩<>!@#~/^&*()-\'\":;,\?`_\\|{}[]$€£¥" ;
return punct.find(c) != std::string::npos;
}
Last edited on Dec 5, 2016 at 9:43am UTC
Dec 5, 2016 at 9:32am UTC
@JLBorges
What if the OP is not allowed to use the <cctype> library? If the OP can use other libraries, then std::reverse() could be used.
P.S. How does line 1 work? Also, what does keyword static do and why do you use it?
Last edited on Dec 5, 2016 at 9:52am UTC