none
I need to convert this to c++ or phyton RRS feed

  • Question

      • static void Main(string[] args)
      • {
      •  
      •  
      • string[] planet = new string[]{"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus","Neptune"};
      • double[] diameter = new double[] { 4879, 12104, 12756, 6792, 142984, 120536, 51118, 49528 };
      • Console.WriteLine("Each planet and its diameter are shown below:");
      • for(int i=0;i<8;i++)
      • {
      • Console.Write("\nPlanet: "+planet[i]);
      • Console.Write("\tDiameter: "+diameter[i]);
      • }
      • Console.ReadLine();
      •  
      •  
      • }
    1. }
    Tuesday, October 10, 2017 11:21 PM

All replies

  • In C++, for example =>

    #include <string>
    #include <vector>
    #include <iostream>
    using namespace std;
    int main()
    {
        vector<wstring> planet = { L"Mercury", L"Venus", L"Earth", L"Mars", L"Jupiter", L"Saturn", L"Uranus", L"Neptune" };
        vector<double> diameter = { 4879, 12104, 12756, 6792, 142984, 120536, 51118, 49528 };
        wcout << L"Each planet and its diameter are shown below:" << endl;
        for (int i = 0; i < 8; i++)
        {
           wcout << L"\nPlanet: " << planet[i];
           wcout << L"\tDiameter: " << diameter[i];
        }
        wstring dummy;
        getline(wcin, dummy);
        return 0;
    }



    • Edited by Castorix31 Wednesday, October 11, 2017 12:06 AM
    • Proposed as answer by Fei HuModerator Wednesday, October 11, 2017 11:56 AM
    Wednesday, October 11, 2017 12:03 AM
  • Hello SLACA,

    The following is phyton example.

    planet =["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus","Neptune"]
    
    diameter = [4879, 12104, 12756, 6792, 142984, 120536, 51118, 49528]
    
    print "\nEach planet and its diameter are shown below"
    
    for i in range(0,8):
    
                    print "\nPlanet: "+planet[i] +"\tDiameter: "+str(diameter[i])
    

    Sincerely,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, October 11, 2017 7:55 AM
    Moderator
  • Hello SLACA,

    Is there anything updated? If the issues has been solved , you could close the thread by marking reply as answer, This can be beneficial to other community members reading this thread.

    Sincerely,
    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Sunday, October 29, 2017 8:34 AM
    Moderator