- #1
needOfHelpCMath
- 72
- 0
View attachment 6372
Here is the attachment for my lab and just need some clarification and guide if I am going in the right direction?
Here is the attachment for my lab and just need some clarification and guide if I am going in the right direction?
HTML:
// Januaray 24 2017
// Lab 0
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
const int COLUMS = 5;
int a;
void findMin(int a[], int size)
{
int min = a[0]; // temp variable...array don't use dot
for (int i = 0; i < size; ++i)
{
if (min > a[i])
{
min = a[i];
}
}
return min;
}
void calulate(string exp)
{
// check for a plus
// if found add the two numbers
// check for minus
// if found, subtract the two numbers
// check for a times
// if found, multiply the two numbers
// check for divide
// if found, divide the to numbers
// if nothing is found
// return
return;
}
double computeAvg(int a[][COLUMS], int row, int column)
{
double sum = 0;
for (int i = 0; i < row; ++i)
{
for (int j = 0; j < column; ++j)
{
sum += a[i][j];
}
}
return sum / (row * column);
}
void sqaureByValue(int squareNum)
{
cout << pow(sqaureNum) << endl;
return;
}
void squareByReference(int& squareRef)
{
cout << sqaureRef << endl;
return;
}
void menu(int numNeg)
{
int i = 0;
for (i = 0; i >= numNeg; --i)
{
cout << numNeg;
}
}
int main()
{
int a = 0;
while ( a != -1) {
cin >> a;
switch (a) {
case 1:
findMin(int a[], int size);
break;
case 2:
calulate(string exp);
break;
case 3:
calulate(a[], size);
break;
case 4:
computeAvg(a[], row, column);
break;
case 5:
squareByValue
break;
case 6:
squareByReference
break;
}
}
}