Hi all. I am very new to C++ (this is my first semester). And I am trying to use functions for the first time. I am aware that in my code I do not have parameters listed so I am getting errors saying that I have too many arguments in my function call. I was just wondering what the work around is? The 1st code is one of my functions while the second code is my attempt to call it (near the bottom). What's the workaround? Thanks a ton in advance.
-V
double surfaceCalc()
{
double edgeLength;
if (rockTypeShape == "PentagonalPyramid")
{
return (sqrt(25 + 10 * sqrt(5)) / 4 + 5 * (sqrt(3) / 4)) *
pow(edgeLength,2);
}
else if (rockTypeShape == "PentagonalBipyramid")
{
return 5 * sqrt(3) / 2 * pow(edgeLength, 2);
}
else if (rockTypeShape == "GyroelongatedSquareDipyramid")
{
return 4 * sqrt(3) * pow(edgeLength, 2);
}
else if (rockTypeShape == "Gyrobifastigium")
{
return (4 + sqrt(3)) * pow(edgeLength, 2);
}
else if (rockTypeShape == "ElongatedPentagonalPyramid")
{
return (sqrt(25 + 10 * sqrt(5)) / 4 + 5 * sqrt(3) / 4 + 5) *
pow(edgeLength, 2);
}
void outputRecords()
{
cout << "--------------------------------" << endl;
cout << "Record: " << records << endl;
fin >> firstName;
fin >> lastName;
fin >> rockTypeShape;
fin >> edgeLength;
fin >> quantity;
cout << firstName << " " << lastName << " ";
cout << "Rock Type: " << rockTypeShape << " ";
cout << "Size: " << edgeLength << " ";
cout << "Amount: " << quantity << endl;
cout << endl;
cout << "Calculations For A " << rockTypeShape << endl;
cout << "Edge Length: " << edgeLength;
cout << endl;
cout << "Surface Area: " << surfaceCalc(rockTypeShape) << " sq ft"; //HERE!
}
EDIT: Heres images of the code if its easier -
https://ibb.co/zNzMWzQ
https://ibb.co/1Zybdc4