#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;
}
}

Recommended Answers

All 4 Replies

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.

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

>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. ;)

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.