### Can you help me?? I'm at wit's end with this matrix

This code works fine without the if loops, but when I add them it just goes forever. I was simply trying to fix the matrix to make it evenly spaced, anyone know how I could do it??

#include <iostream>
#include <math.h>

using namespace std;

double Fun (double iX, double iY)
{return sqrt(iX*iX+iY*iY);}

int main (void)
{double iX =1.0, iY=1.0;
cout << "\t 1\t2\t\t3\t\t4\t\t5"<<endl;
cout <<"1\t";
for (iX=1.0; iX<=5.0; iX++)
{cout << Fun (iX,iY) << "\t " ;}
cout <<"2\t";
iY=2.0;
iX=1.0;
for (iX=1.0; iX<=5.0; iX++)
{cout << Fun (iX,iY) << "\t " ;}
cout <<"3\t";
iY=3.0;
iX=1.0;
for (iX=1.0; iX<=5.0; iX++)
{cout << Fun (iX,iY) << "\t " ;
if (iX==4){cout << "\t" ;}}
cout <<"\n4\t";
iY=4.0;
iX=1.0;
for (iX=1.0; iX<=5.0; iX++)
{cout << Fun (iX,iY) << "\t " ;
if ((iX==3)||(iX=4)){cout << "\t" ;}}
cout <<"\n5\t";
iY=5.0;
iX=1.0;
for (iX=1.0; iX<=5.0; iX++)
{cout << Fun (iX,iY) << "\t " ;}
return 1;}
Last edited on
Use
 `[code][/code]`
tags.
This may be a ridiculous question, but what are those? How could I use them to fix this code?
Bourgond is pleading of you to use the code tags (<>) button to the right. It will make your code much easier to see. Also, don't forget to indent your code.

Example of code tage use:
 ```[code] int main(){ std::cout << "Hello world!" << std::endl; return 0; } [/code]```

Produces:
 ``1234`` ``````int main(){ std::cout << "Hello world!" << std::endl; return 0; }``````

It really would help everyone out if you put your code in code tags.
 ``12345678910111213141516171819202122232425262728293031323334353637`` ``````#include #include using namespace std; double Fun (double iX, double iY) {return sqrt(iX*iX+iY*iY);} int main (void) {double iX =1.0, iY=1.0; cout << "\t 1\t2\t\t3\t\t4\t\t5"<

if ((iX==3)||(iX=4)){cout << "\t" ;}} iX=4 U NEED ==
:D :P
omg YES! I knew it was something stupid like that... Good eye topnik1!!
xd
Topic archived. No new replies allowed.