CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2017
    Location
    sc
    Posts
    5

    c++ code snippet requiring conversion to java

    I have a need for someone to translate this language to java that way I can use the example to apply what I have learned to the rest of the code. I have almost 2000 line of codes. This logic I think I should get help with changing into java. I am using eclipse neon for java and code::blocks 13.12 for c++ Thanks.

    Code:
    void RiskScore::setNumDevices(double numDevices_sum)
                    {
                                    numDevices = numDevices_sum;
                                    bool r_int = false;
                                    cout<<"\n(2)Enter the number of devices affected or damaged:";
    
                            while (!(cin>>numDevices_sum))
                                {
                                    cin.clear();
                                    cin.ignore(numeric_limits<streamsize>::max(),'\n');
                                    cout <<"Please enter whole numbers; no decimal numbers e.g 0 or 1 or 2 or 10 or 11 etc: " << endl;
                                }
    
    
                            while (!r_int)
                                {
    
                                    if (numDevices_sum>=1.0)
                                            {
                                                r_int = true;
                                                numDevices = numDevices_sum;
                                                cout<<"\nThe number of devices here are"<<" "<< numDevices_sum<<endl;
                                            }
    
                                    else if(numDevices_sum==0.0)
                                            {
                                                r_int = true;
                                                numDevices=numDevices_sum;
                                                cout<<"The number of devices are"<<" "<<numDevices_sum<<endl;
                                            }
    
    
                                        else
                                            {
    
                                                cout <<"\nMust re-enter a whole number to continue.\n";
                                                cin>>numDevices_sum;
                                                cout << "\n  thank you!\n " << endl;
    
                                            }
    
                              }
    
                    }
    
        double RiskScore::getNumDevices()
                    {
                        return numDevices;
                    }

  2. #2
    Join Date
    Feb 2017
    Posts
    677

    Re: c++ code snippet requiring conversion to java

    Quote Originally Posted by lokdon View Post
    I have almost 2000 line of codes.
    Why not try a C++ to Java converter,

    https://www.tangiblesoftwaresolution...r_details.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured