So I am a beginner to C++..I was doing this algorithm when some errors occurred
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include <iostream.h>
usingnamespace std;
int main ()
{
int a,b,x;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
if (a!=0) x=(-b/a);cout<<"x="<<x;
elseif (b!=0) cout<<"Infinity of solutions";
else cout<<"no solution";
return 0;
}
What is wrong with this???? The errors i get are :
expected primary-expression before "else"
expected `;' before "else"
expected primary-expression before "else"
expected `;' before "else"
This goes for both "else" I must mention that I use MinGW developer studio.And one last question,Should I use visual studio ? If so what is the difference between a custom C++ dev. program and visual studio?
Thank you for your adivse.