On-line: гостей 0. Всего: 0 [подробнее..]
Программисты всех стран, объединяйтесь!

АвторСообщение



ссылка на сообщение  Отправлено: 08.11.12 16:13. Заголовок: Basic Palindrome vector


#include <iostream> 
#include <vector>
#include <string>

using namespace std;

int main(){

string words;

cout <<"Enter words : " ;
getline( cin,words );

string wordsReverse( words.rbegin() , words.rend() );
cout << "\nBackwards , it's : " << wordsReverse << endl << endl;


if( words == wordsReverse )
cout << words << " is a palindrome !" << endl;
else
cout << words << " is not a palindrome ! " << endl;

system( "pause" );//Pause window
return 0;//Exit Program
}


i know it's not hard .
but the problem is , here is the question
A palindrome is a sequence of characters, numbers or words that have the property of reading the same in either direction (backwards or forwards). In a palindrome white space and punctuation have no significance (they are typically ignored).

Examples of palindromes are shown below.

121 - A numeric sequence
GACTTCAG - A DNA Sequence
Sator Arepo tenet opera rotas - A latin phrase for: The farmer by his labour keeps the wheels to the plough.

As you can see in the last example, white space and capitalisation are ignored. You are to write a program that takes in a sequence and works out if it is/isn’t a palindrome. We are going to do this in three different ways.


how to ignore capitalisation and while space ?
Besides that . how to change the iterator STL to vector STL ?


Спасибо: 0 
ПрофильЦитата Ответить
Ответов - 39 , стр: 1 2 All [только новые]


Ответов - 39 , стр: 1 2 All [только новые]
Ответ:
1 2 3 4 5 6 7 8 9
большой шрифт малый шрифт надстрочный подстрочный заголовок большой заголовок видео с youtube.com картинка из интернета картинка с компьютера ссылка файл с компьютера русская клавиатура транслитератор  цитата  кавычки моноширинный шрифт моноширинный шрифт горизонтальная линия отступ точка LI бегущая строка оффтопик свернутый текст

показывать это сообщение только модераторам
не делать ссылки активными
Имя, пароль:      зарегистрироваться    
Тему читают:
- участник сейчас на форуме
- участник вне форума
Все даты в формате GMT  3 час. Хитов сегодня: 1
Права: смайлы да, картинки да, шрифты да, голосования нет
аватары да, автозамена ссылок вкл, премодерация откл, правка нет