gcc compiler bat

master
IoTcat 5 years ago
parent 10b875b78e
commit 2b0d832aec
  1. 2
      .gitignore
  2. 2
      as1/.gitignore
  3. 34
      as1/Fraction_test.cpp
  4. 12
      as1/README.md
  5. 38
      as1/compilergcc.bat

2
.gitignore vendored

@ -0,0 +1,2 @@
/test
*.exe

2
as1/.gitignore vendored

@ -0,0 +1,2 @@
/test
*.exe

@ -9,7 +9,7 @@ int main()
Fraction b(3,-4);
Fraction c(5);
Fraction d(-3.14);
Fraction e = 1.3333;
Fraction e = 1.333333;
Fraction f = -b;
@ -78,6 +78,12 @@ int main()
cout << "; b = " << b << endl << endl;
cout << "b += c; b = " << (b+=c) << endl;
cout << "b -= c; b = " << (b-=c) << endl;
cout << "b *= c; b = " << (b*=c) << endl;
cout << "b /= c; b = " << (b/=c) << endl << endl;
cout << "if b > c ?? " << ((b>c)? "Yes" : "No") << endl;
cout << "if b < c ?? " << ((b<c)? "Yes" : "No") << endl;
cout << "if b >= c ?? " << ((b>=c)? "Yes" : "No") << endl;
@ -87,11 +93,6 @@ int main()
cout << "if b != c ?? " << ((b!=c)? "Yes" : "No") << endl << endl;
cout << "b += c; b = " << (b+=c) << endl;
cout << "b -= c; b = " << (b-=c) << endl;
cout << "b *= c; b = " << (b*=c) << endl;
cout << "b /= c; b = " << (b/=c) << endl << endl;
cout << "Devide 0 test: ";
try{
@ -100,14 +101,21 @@ int main()
cout << msg << endl;
}
cout << endl << "************ This is the END of TEST section !! ************" << endl << endl;
cout << "Have a try by YOURSELF!! (Press Ctrl+C to quit)" << endl;
while(1){
try{
cout << endl << "Please Input a Fraction(-3/5) or a Decimals(e.g. 3.14): ";
cin >> a;
cout << a << endl;
}catch(const char* msg){
cout << endl << msg << endl;
}}
try{
cout << endl << "Please Input a Fraction(-3/5) or a Decimals(e.g. 3.14): ";
cin >> a;
cout << a << endl;
}catch(const char* msg){
cout << endl << msg << endl;
}
}
return 0;
}

@ -0,0 +1,12 @@
## How to begin
Please execute the compilergcc.bat to compile.<br/>
Or you can install gcc manually and use the following command to compile.
````
$ g++ -O2 -o same_vec same_vec.cpp
$ g++ -O2 -o Fraction_test Fraction_test.cpp Fraction.h
````
## gcc Download url
**For windows**
https://yimian-setup.obs.myhwclouds.com/setup/tdm64-gcc-5.1.0-2.exe

@ -0,0 +1,38 @@
@echo off
where g++>nul
cls
if errorlevel 1 (
echo gcc NOT FOUND in your computer!!
echo Press any key to start installation!
pause>nul
goto install
) else (
echo Detected gcc Environment..
echo Start to compile!!
goto compile
)
:install
cls
echo Please download and run the gcc install program.
ping 127.0.0.1 >nul
start https://yimian-setup.obs.myhwclouds.com/setup/tdm64-gcc-5.1.0-2.exe
ping 127.0.0.1 >nul
cls
echo After install, Please restart this script to compile!!&&pause&&exit
:compile
cls
echo compiling...
g++ -O2 -o same_vec same_vec.cpp
g++ -O2 -o Fraction_test Fraction_test.cpp Fraction.h
cls
echo compile finished! The program is in current folder!
pause
exit
Loading…
Cancel
Save