#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
我需要有关此代码的帮助。我的编译器一直要求我使用 -fpermissive 选项,但我不知道在哪里输入它。我已经粘贴了下面的代码和显示的错误。
using namespace std;
int cx = 0, cy = 0;
double x =0, y=0, r = 5;
int main(){
ofstream myfile;
myfile.open("dingo.txt");
for(int g =0 ; g <= 360; g++)
//find x and y
//Get points of a circle.
x = cx + r * cos(g);
y = cy + r * sin(g);
//This is what pops up below:
//In function int main()':
//Error: name lookup of 'g' changed for ISO 'for' scoping [-fpermissive]
//note: (if you use '-fpermissive' G++ will accept your code)
//where should I enter the required option?
myfile << "X: " << x << "; Y: " << y <<endl;
myfile.close();
return 0;
}