How to get Dev-Cpp to support chinese characters and pinyin.

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 36
Reputation: amerninja2 has a little shameless behaviour in the past 
Solved Threads: 0
amerninja2 amerninja2 is offline Offline
Light Poster

How to get Dev-Cpp to support chinese characters and pinyin.

 
0
  #1
Oct 14th, 2008
How can I get a compiler for C++ like Dev-Cpp to support chinese character and pinyin input? Like if I wanted to make a chinese program that would allow chinese input and output in the console window... Example:

  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int main() {
  5. wchar_t input;
  6. char loop;
  7.  
  8. loop='a';
  9. while(loop = 'a') {
  10.  
  11. system("CLS");
  12. cout << "Input Chinese Characters or pinyin to translate to english: ";
  13. cin >> input;
  14. if(input = "你") {
  15. cout << "nǐ = you" << endl;
  16. }
  17. if(input = "您") {
  18. cout << "nín = you (with respect)" << endl;
  19. }
  20. if(input = "我") {
  21. cout << "wǒ = I; me; my; (anything that has to do with yourself)" << endl;
  22. }
  23. if(input = "星") {
  24. cout << "xīng = star;" << endl;
  25. }
  26. if(input = "期") {
  27. cout << "qī = period of time; " << endl;
  28. }
  29. if(input = "子") {
  30. cout << "zi = word; character;" << endl;
  31. }
  32. if(input = "好") {
  33. cout << "hǎo = to be good/well;" << endl;
  34. }
  35. if(input = "姓") {
  36. cout << "xìng = family name; last name;" << endl;
  37. }
  38. if(input = "今") {
  39. cout << "jīn = now;" << endl;
  40. }
  41. if(input = "天") {
  42. cout << "tiān = today; sky;" << endl;
  43. }
  44. }
  45. return 0;
  46. }

etc.

So pinyin is like 'xìng' and the characters are like '姓'. So some how im wondering how I could create a program that would be like a dictionary type thing.

BONUS:
你教什么名字 = nǐ jiáo shén me míng zi? = whats your full name?
您好 = nín hǎo! = hello! (Respectfully).
今天星期二 = jīn tiān xīng qī èr = today is tuesday.
星期 = xīng qī = week.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 305
Reputation: stilllearning has a spectacular aura about stilllearning has a spectacular aura about 
Solved Threads: 43
stilllearning stilllearning is offline Offline
Posting Whiz

Re: How to get Dev-Cpp to support chinese characters and pinyin.

 
0
  #2
Oct 14th, 2008
I don't think there is a type that will allow you support chinese characters natively. You will need some kind of unicode support for it. I don't know if there is an external library out there that will allow you to read these in. But in the absence of that, you will need to build in a mapping table, and map the bytes you are reading in to your table, and probably have another table for any corresponding translated values.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: How to get Dev-Cpp to support chinese characters and pinyin.

 
0
  #3
Oct 15th, 2008
First step would be to learn the difference between = and == when comparing stuff.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC