Im having trouble making this code into psuedo code, any help would be appriciated
#include <iostream>
using namespace std;
void getArray(double arValues[10])
{
cout << "Please enter 10 numbers :" << endl;
for (int i = 0; i < 10; i++)
cin >> arValues[i];
}
void printArray(double arValues[10])
{
cout << "Numbers in array :" << endl;
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 5; j++)
cout << arValues[i * 5 + j] << " ";
cout << endl;
}
}
double getAverage(double arValues[10])
{
double dsum = 0;
for (int i = 0; i < 10; i++)
dsum += arValues[i];
return dsum / 10;
}
int main()
{
// array
double arValues[10];
// get 10 numbers from user
getArray(arValues);
// print array
printArray(arValues);
// calculate average and print it
cout << "Average of Array : " << getAverage(arValues);
return 0;
}
Copyright © 2024 QUIZLS.COM - All rights reserved.
Answers & Comments
Verified answer
Usually you create pseudo code first as a template for your real code, not the other way around. But having said that, simply convert what you have here into simple English terms. For example if your statment was i = i+1; you might write "increment i". For something like cout<<i you might write "print i".
you're in basic terms taking the numbers and pulling out the initiating. So in case you have one hundred fifty you will finally end up with a million 5 0 upload numbers on your variables and do the mathematics. The code is already there.