#include<iostream>
using namespace std;
int main(){
int slopeVal=0;
int slopeVal2=0;
cout<<"Please input the first slope value: ";
cin>>slopeVal>>endl;
cout<<"Please input the second slope value: ";
com>>slopeVal2>>endl;
return 0;
}
int findLine(int slopeVal, int slopeVal2){
if(slopeVal==slopeVal2){
cout<<"The two lines are parallel.";}
else if(slopeVal==(slopeVal2*-1)){
cout<<"The two lines are perpendicular.";}
else{
cout<<"The lines are normal intersected";}
}
#include<iostream>
using namespace std;
/* The reason you get the "identifier not found" error is because findLine is after main.
* The compiler never lets the program know there is a function called findLine that takes
* two int parameters and returns an int value.
* To fix the error put the function + scope before main or just the function and parameters like this:
int findLine(int slopeVal, int slopeVal2);*/
int main(){
int slopeVal = 0;
int slopeVal2 = 0;
cout << "Please input the first slope value: ";
cin >> slopeVal >> endl; // cin does not use endl; endl clears the buffer on the output stream. cin is the input stream.
/* correct way:
cin >> slopeVal; */
cout << "Please input the second slope value: ";
com >> slopeVal2 >> endl; // I think you meant "cin" not "com". Also, refer to the one above.
/* correct way:
cin >> slopeVal2;*/
/* You never actually call findLine.
findline(slopeVal, slopeVal2);*/
return 0;
}
int findLine(int slopeVal, int slopeVal2){
/* Nothing is really in error here except you need to return a value. since findLine is type int it's expecting you
* to return an int value.
* You never return an int value. */
if (slopeVal == slopeVal2){
cout << "The two lines are parallel."; // Works, but it does not endl (which clears the buffer).
}
else if (slopeVal == (slopeVal2*-1)){
cout << "The two lines are perpendicular."; // Same as the first.
}
else{
cout << "The lines are normal intersected"; // Same as the first and second.
}
/* no return at the end of the function, all you do is cout.
* correct way:
return 0;*/
}
// judge if two lines are parallel, perpendiculr, or neither
#include <iostream>
using namespace std;
int findLine(int, int);
int main()
{
int num, slopeVal, slopeVal2;
cout << "Please input two slope values: " << endl;
cin >> slopeVal >> slopeVal2;
num = findLine(slopeVal, slopeVal2);
switch (num){
case (0) :
cout << "The lines are parallel." << endl;
break;
case (2) :
cout << "The lines are perpendicular." << endl;
break;
case (3) :
cout << "The lines are neither." << endl;
break;
default:
cout << "Invalid lines." << endl;
}
}
int findLine(int x, int y)
{
if (x == y)
return 0;
else if (x == (y * -1))
return 1;
else
return 2;
}
// judge if two lines are parallel, perpendiculr, or neither
#include <iostream>
using namespace std;
int main()
{
int slopeVal, slopeVal2;
cout << "Please input two slope values: " << endl;
cin >> slopeVal >> slopeVal2;
cout << ((slopeVal == slopeVal2) ? "The lines are parallel." : (slopeVal == (slopeVal2 * -1)) ? "The linesa re perpendicular." :
(slopeVal != slopeVal2) ? "The lines are neither." : "Invalid lines.") << endl;
}
// judge if two lines are parallel, perpendiculr, or neither
#include <iostream>
using namespace std;
int main()
{
int slopeVal, slopeVal2;
cout << "Please input two slope values: " << endl;
cin >> slopeVal >> slopeVal2;
cout << ((slopeVal == slopeVal2) ? "The lines are parallel." :
(slopeVal == (slopeVal2 * -1)) ? "The linesa re perpendicular." :
(slopeVal != slopeVal2) ? "The lines are neither." :
"Invalid lines.") << endl;
}