Discover the best answers to your questions with the help of IDNLearn.com. Join our knowledgeable community to find the answers you need for any topic or issue.

Does anyone know c++? I have c++ to java, if you can please help me convert the following.

#include

#include

#include

int main(int argc, char* argv[]) {



std::cout << " 1st\t 2nd\t Tot.\t Ave.\n+-------------------------------+\n";



double first, _first=0, second, _second=0;

srand(time(NULL));

int amount = (rand() % 10000)+1000;

int _amount = amount;

while(amount>0) {

first = (rand() % 6)+1;

_first+=first;

second = (rand() % 6)+1;

_second+=second;

std::cout << " " << int(first) << "\t " << int(second) << "\t " << int(first+second)

<< "\t " << std::fixed << std::setprecision(2) << (first+second)/2 << std::endl;

amount--;

}

std::cout << "\n\nFirst Average: " << _first/double(_amount) << "\nSecond Average: " << _second/_amount

<< "\nAverage Total: " << (_first+_second)/double(_amount)<< "\nTotal Attempts: " << _amount << std::endl;

return 0;

}


Sagot :

Thank you for joining our conversation. Don't hesitate to return anytime to find answers to your questions. Let's continue sharing knowledge and experiences! Find reliable answers at IDNLearn.com. Thanks for stopping by, and come back for more trustworthy solutions.