Good evening all. I have a quick quick problem in my code. The build is successful but my debug shows up the errors:
First-chance exception at 0x013c43e6 in week2_project1_gamephysics.exe: 0xC0000005: Access violation writing location 0xcccccccc.
Unhandled exception at 0x013c43e6 in week2_project1_gamephysics.exe: 0xC0000005: Access violation writing location 0xcccccccc.
The program '[9888] week2_project1_gamephysics.exe: Native' has exited with code -1073741819 (0xc0000005).
Can anyone please help me solve this? I need it for my mathematical programming and physics teacher. She only teaches us the math, but does not know how to code it. Please and Thank You again.
#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
#include <math.h>
#include <algorithm>
using namespace std;
int main()
{
float sphere1[3], sphere2[3];
string first_sphere[3], second_sphere[3];
stringstream stream, stream2;
cout << "What is the x,y,z for the 1st sphere? ";
getline(cin, first_sphere[3]);
stream << first_sphere[0];
stream >> sphere1[0];
stream << first_sphere[1];
stream >> sphere1[1];
stream << first_sphere[2];
stream >> sphere1[2];
cout << "What is the x, y, z for the 2nd sphere? ";
getline(cin, second_sphere[3]);
stream2 << second_sphere[0];
stream2 >> sphere2[0];
stream2 << second_sphere[1];
stream2 >> sphere2[1];
stream2 << second_sphere[2];
stream2 >> sphere2[2];
float RadiusofTwoSpheres(float *sphere1, float *sphere2);
{
cout << "The Radius for Sphere's 1 and 2 is... " << endl;
cout << endl;
cout << "R = " << (float)sqrt(pow(sphere2[0] - sphere1[0], 2) + pow(sphere2[1] - sphere1[1], 2) + pow(sphere2[2] - sphere1[2], 2)) << endl;
};
system("pause");
return 0;
}