do
{
cout<<"Enter period(number of cycles) you want : ";
cin>>x3;
for (int i=-700;i<SIZE;i++)
{
x1=((float)i/SIZE);
x2=(((float)(i+1))/SIZE);
y1=sin(x1*x3*PI);
y2=sin(x2*x3*PI);
drawline(x1,y1,x2,y2);
}
glutSwapBuffers();
cout<<"Do you want to continue to draw? (Y/N) ";
cin>>again;
}while(again=='Y' && again=='y');
cout<<"Enter the type of graph you want(1,2,3 or 4) : ";
cin>>choice;
switch(choice)
{
case 1: glutCreateWindow(" Sine Graph ");
glutDisplayFunc(sinegraph);
break;
case 2: glutCreateWindow(" Cosine Graph ");
glutDisplayFunc(cosinegraph);
break;
case 3: glutCreateWindow(" Tangent Graph ");
glutDisplayFunc(tangentgraph);
break;
default:exit(0);
}
}作者: Super-Tomato 时间: 2011-4-9 02:20 AM