推介:| Web Hosting | 外賣系統 | Server colocation | Web Shop System | Makeup course |

查看完整版本: 如果將以下Java程式改為用C++程式來寫會如何呢??

花之慶次 2008-8-2 00:09

如果將以下Java程式改為用C++程式來寫會如何呢??

import java.io.*;
class EchoPlayer2
{
   public String echo(String msg)
   {
       return"echo:" +msg;
   }
   public void talk()throws IOException   
   {
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       String msg=null;
       while((msg=br.readLine())!=null)
       {
          System.out.println(echo(msg));
          if(msg.equals("bye"))
            break;
       }
    }
    public static void main(String arg[])throws IOException
    {
          new EchoPlayer().talk();
    }
}

我想知道EchoClient和EchoServer兩者如果用C++是如何表達呢??
當然, 因為這是用Java程式撰寫, 如果用C++是不能寫的話可不可以指出為什麼???
頁: [1]
查看完整版本: 如果將以下Java程式改為用C++程式來寫會如何呢??