Good night, I wrote a file in c ++ but it is no longer working, the code compiles everything right, but if I put it to run it appears the message that the program stopped working, if anyone can help me I will be very grateful. code below!
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <stdlib.h>
#include <string>
#define K 9.0e09 // constante eletrica no vacuo
using namespace std;
int main(int argc,char **argv)
{
int Q1 = atof(argv[1]);
int Q2 = atof(argv[2]);
double dist = atof(argv[3]);
/*
int Q1, Q2;
double dist;
cin >> Q1;
cin >> Q2;
cin >> dist;
//char *OutputFileName=argv[4];
int Q1 = 1;
int Q2 = 2;
double dist = 0.01;
*/
ofstream Output1("Output.dat"); // valor da força elétrica (em Newtons)
cout << "Forca eletrica = " << (K*Q1*Q2*pow(10,-12))/pow(dist,2) << endl;
Output1 << Q1 << " " << Q2 << " " << dist << " " << (K*Q1*Q2*pow(10,-12))/pow(dist,2) << endl;
return 0;
} //int main
/*-----------------------end of main program--------------------------*/