Please help me to solve this problem..i need it today!
Thank you.

Sample input:
Z Cozompuzutezer

Sample output:
Computer

Onlineshade commented: Try yourselt the logic. -1

Recommended Answers

All 11 Replies

Any particular language?
If so, you might need to move this question to a specific language area and show some of the code you've already started.

Enteng, your grade 6 nephew, and his friends like to keep secrets from you. Whenever you are around, they start talking in words you cannot understand. After a few days of listening in to their conversations, you finally understood what they are saying. You realized that they are actually using Tagalog in their conversations. However, the words they are speaking are codified using a very simple method: after each vowel in a word, a key consonant, is added and the vowel is repeated.

Thus, when Enteng said “Hibindibi nibiyaba tabayobo mabaibiibintibindibihaban,” you recognized that the key consonant he used is B and you translated the sentence as “Hindi niya tayo maiintindihan.” You were also thankful that Enteng and his friends use one key consonant only for all the words in a single sentence.

Enteng’s father, however, still cannot understand his son and his friends whenever they speak in codes. You decided to help him by creating a program that will translate a codified Tagalog
sentence.

INPUT FORMAT
A file containing the sentences to be translated. Each line in the file contains one sentence preceded
by the key consonant being used. Input file is encrypt.txt

OUTPUT FORMAT
The translated sentence.

SAMPLE INPUT
Z Computer
S College

SAMPLE OUTPUT
Cozoppuzutezer
Cosollesegese


this is the problem in c++..and i dont have any idea about this problem..

Is Dot Net C++/CLI allowed?

commented: This is the C++ forum. The anser is to be in C++ -4

where using Dev-c++...

DotNet and CLI isn't needed. This isn't anything plain old C++ can't handle. It's a string manipulation exercise. You need to be able to...

  1. Find characters within strings.
  2. Take apart strings.
  3. Conacatenate strings.

http://www.cplusplus.com/reference/string/string/


The string library has all you need.


That said, on a non-programming note, it seems to me that the example doesn't follow the rules.


Z Computer --> Cozoppuzutezer

What happened to the 'm' in computer? I don't interpret the rules as saying any letters get replaced. They're only ADDED. But that's not a programming issue. That's an issue of confirming that you understand the rules. If the examples are correct and follow the rules, I for one do not. Maybe you need to understand Tagalog to understand.

DotNet and CLI isn't needed.

Thanks. I'm just finding out what's "allowed".

So, it looks like the elements required are:
1) A file reader
2) A decoder
3) An encoder

Is this correct?

After looking at the requirements again, it does not seem a decoder is necessary; just an encoder.

Since you seem to be in a hurry, I've left only one part left to complete.
Here is a shell of a program that will let you concentrate on the part you really should understand.

#include<iostream>
#include<fstream>
using namespace std;
string Encode(char cConst, string strSentence)
{
	char c = tolower(cConst);
	string strRetVal = "";
	string strVowels = "aeiouAEIOU";
	
/*finish this part*/

	return strRetVal;
}

int main(void)
{
	ifstream fileIn("c:/science/encrypt.txt", ifstream::in);
	char pstrData[128] = {0};//arbitrary length

	while(!fileIn.eof())
	{
		fileIn.getline(pstrData, 127);
		//cout << pstrData << endl;
		cout << Encode(pstrData[0], pstrData+2).c_str() << endl;
	}

	fileIn.close();
	return 0;
}

Thank you guys for helping me...

so now i know how to do it..

im not good in programing that's why im here to ask your help


i have new problem can you help me again??

We can probably help again, but it would be useful to know what your new problem is. :) As usual include (1) what you're trying to accomplish, (2) the code (or an appropriate portion of it) that you've written so far, (3) what it's doing wrong, and (4) what you've tried so far that hasn't worked for you. We don't ask this to be annoying, it actually helps you: learning how to ask for help in a clear way actually forces you to think through your own problem in an organized manner, so that you can start seeing how to fix issues without actually needing to ask the questions!

deanbrogada,
If your problem is solved , then marked it as solved problem.
Thank you.

To discuss a new problem start a new thread.
OK.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.