Hi all, i have the following codes, but i would like to know how can i transform my codes to become using multidimensional array codes. Appreciate if anyone could show me and help me to convert it.
#include "stdafx.h"
#include <iostream>
usingnamespace std;
int main()
{
char name [100];
cout<<"This is an Calculator to calculate number of Employees having total salary and bonus more than 1000" << endl;
cout<<"What is your name?" << endl;
cin.getline (name,100);
cout<<"Hello, " << name << "." << endl;
int Salary[10], Bonus[10], lCount=0, gCount=0, i=0, j=0;
cout<<"Please Enter Employees Salary (Max 10 Employees)" << endl;
for (i=0; i<10; i++)
{
cout<<"Enter Employee " << i+1 << " Salary : " ;
cin>>Salary[i];
cin.ignore();
}
for (j=0; j<10; j++)
{
cout<<"Enter Employee " << j+1 << " Bonus : ";
cin>>Bonus[j];
cin.ignore();
}
for (i=0; i < 10; ++i)
{
if (Salary[i]+Bonus[i]>1001)
{lCount++;}
else
{gCount++;}
}
cout<<"There are " << lCount << " Employees with Salary and Bonus more then 1000\n";
cout<<"There are " << gCount << " Employees with Salary and Bonus less then 1000\n";
cin.get();
}
hi, the output will be the same (calculating the the numbers of employees with salary and bonus more and less than 1000) using multidimensional arrays.
Magnificence7 - anything is fine, maybe u could show me your way ?
I'm not sure about line 11, I think it's supposed to be: getline( inputstream, storage );
Also mulitiD arrays are a bad idea, because things typically get more complicated. http://cplusplus.com/forum/articles/17108/