Asked by Olivia
Please suggest corrections to this code: why isn't the loop continuing ANY help is appreciated!
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
double slope;
int yint;
int x;
double cord;
double coordinate(int x, double slope, int yint);
cout<<"Welcome to the Linear Equation Program."<<endl;
cout<<"This program will return coordinates for a specific linear equation."<<endl;
cout<<"Please enter the slope of the line: "<<endl;
cin>>slope;
cout<<"Please enter the y-intercept: "<<endl;
cin>>yint;
for (x=-2; x < 2; x++);
{
cout<<setprecision(2);
cout.setf(ios::showpoint | ios::fixed);
double coordinate =((x*slope) + yint);
cout<<"The coordinates necessary to graph the line y= "<<slope<<"x + "<<yint<<" are:"<<endl;
cout<<setw(5)<<"x"<<setw(15)<<"y"<<setw(15)<<endl;
cout<<setw(5)<<x<<setw(15)<<cord<<endl;
}
return 0;
#include <iostream>
#include <iomanip>
using namespace std;
int main () {
double slope;
int yint;
int x;
double cord;
double coordinate(int x, double slope, int yint);
cout<<"Welcome to the Linear Equation Program."<<endl;
cout<<"This program will return coordinates for a specific linear equation."<<endl;
cout<<"Please enter the slope of the line: "<<endl;
cin>>slope;
cout<<"Please enter the y-intercept: "<<endl;
cin>>yint;
for (x=-2; x < 2; x++);
{
cout<<setprecision(2);
cout.setf(ios::showpoint | ios::fixed);
double coordinate =((x*slope) + yint);
cout<<"The coordinates necessary to graph the line y= "<<slope<<"x + "<<yint<<" are:"<<endl;
cout<<setw(5)<<"x"<<setw(15)<<"y"<<setw(15)<<endl;
cout<<setw(5)<<x<<setw(15)<<cord<<endl;
}
return 0;
Answers
Answered by
Steve
Lose the ; on the for statement!
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.