Question
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
Lose the ; on the for statement!
Related Questions
What kind of loop should be used in a game where the user is guessing a secret code and the message...
Which of the following could you include in Python code to anticipate and catch an error?
(1 poin...
Which of the following could you include in Python code to anticipate and catch an error? (1 point)...
Which general while loop definition is written correctly?
A
while (x is true) {
// code...