I need help with this task
1) File.bat will open program.exe written in c++
2) Using .bat i need to read data from 3-4 files in folder data, then insert it into my c++ file.
3) When program stops calculating i need to insert results to the .txt files in folder output.
Example of files
Folder Data
Data1.txt
0, 0, 20, 0, 10, 30, 10, 15
there will be more under
Data2.txt
4, 2, 10, -4, 10, 20, 0, -300
there will be more under
Program below will check if point is in triangle or outside
Program.exe
#include < bits / stdc++.h >
using namespace std;
float wspolrzedne(int x1, int y1, int x2, int y2, int x3, int y3)
{
return abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
}
bool wewnatrz(int x1, int y1, int x2, int y2, int x3, int y3, int x, int y)
{
float A = wspolrzedne(x1, y1, x2, y2, x3, y3);
float A1 = wspolrzedne(x, y, x2, y2, x3, y3);
float A2 = wspolrzedne(x1, y1, x, y, x3, y3);
float A3 = wspolrzedne(x1, y1, x2, y2, x, y);
return (A == A1 + A2 + A3);
}
int main()
{
if (wewnatrz(input.txt))
printf("Inside");
else
printf("Outside");
insert into output.txt
return 0;
}
Folder output
Output1.txt
Inside
there will be more under
Output2.txt
Outside
there will be more under
bat file
@echo off
:menu
cls
echo ========MENU=======
echo === 1. Start ====
echo === 2. Info ====
echo === 3. Backup ====
echo === 4. Exit ====
echo ===================
set /p select="Select 1,2,3,4: "
IF %select%==1 goto opt1
IF %select%==2 goto opt2
IF %select%==3 goto opt3
IF %select%==4 goto exit
:opt1
echo Data from files will be collected and processed.
????????
pause
goto menu
:opt2
echo This program checks if point is in or outside triangle
pause
goto menu
:opt3
echo Your backup is on the way
Xcopy %cd% %cd%\Backup /M /E /G /H /Y
pause
goto menu
:exit
echo Bye!
pause
How i can connect it all? I don't have idea.