0
#include <iostream.h>
#include <math.h>
void main () 
{ 
int n,j,q,d,h,t,i,m,f,b;
cout<<" num of eng";
cin >> j;
q=0;
d=0;
h=0;
t=0;
for (i=1;i<=j;i++)
{cout<< "insert Salary ";
cin>> m;
m /(22) =d;
d/(8) = h;
cout<<"\n Leave ";
cin>>f;
cout<< "\n Attend ";
cin >> b;
f - b = t;
t * h = q;
cout<<"q="<<q;
}
}

Edited by Nick Evan: Added code-tags

5
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by firstPerson
1
m /(22) =d;
d/(8) = h;

These don't work. You need a single variable on the left. Do whatever algebra you need to to accomplish this:

m =d * 22;
d = h * 8;

or if you are trying to do an assignment to d and h, switch sides:

d = m /(22);
h = d/(8);

This may not be what you want, but it'll compile.

Edited by happygeek: fixed formatting

0

Yea, looking at your code makes my brain hurt.
A) Please read the forum rules on Code tags and....
B) You need to work on your style

0

>Yea, looking at your code makes my brain hurt.
If you're not exaggerating then you should probably do something about that weak mind. Maybe take up sudoku. ;)

Edited by Narue: n/a

0

When posting code, the format should look something like this( see below), if it isn't then make it until it is. This is not only help us read
better, but it will also help you get better comments.

//notice not .h
#include <iostream>
#include <cmath>

using namespace std;

int main () 
{ 
  //initialize variable upon decelerations, why aren't you using arrays?
   int n(0),j(0),q(0),d(0),h(0),t(0),i(0),m(0),f(0),b(0);
  
  cout<<" num of eng";
  cin >> j;

  for (i=1;i<=j;i++)
  {
	  cout<< "insert Salary ";
	  cin>> m;
  
	  //you got is in opposite order, its d = m/22    
	  m /(22) =d;//See what VernonDozier said   
	  d/(8) = h;//See what VernonDozier said

	  cout<<"\n Leave ";
	  cin>>f;
  
	  cout<< "\n Attend ";
	  cin >> b;
 
	  f - b = t;
	  t * h = q;

	  cout<<"q="<<q;
  }

  return 0; //main returns something
}

Now look back at your 1st post and look at this post, realize how
much more readable this post is?

Edited by firstPerson: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.