0

Help me

Can someone help me with my code #c++

13th Apr 2018, 10:09 AM
latifah alghanem
latifah alghanem - avatar
10 Answers
+ 1
#include <stdio.h> #include <string.h> #include <iostream> #include <string> using namespace std; int calculateAverageScores(int scores[],int size); void displayPlayerData(string playerNames[],int scores[], int size); int calculateAverageScores(int scores[],int size); int inputData(string playerNames[], int scores[],int size) { int i; for(int i=0;i<size;i++) { cout << "Enter Player Name: "; getline(cin,playerNames[i]);} cout << "Enter score for " << playerNames[i] << ": "; cin >> scores[i]; cin.ignore();} return i;} void displayPlayerData(string playerNames[],int scores[], int size) for (int i=0;i<size;i++) { cout << playerNames[i] << "\t" << scores[i] << endl;} } int calculateAverageScores(int scores[],int size) { int i; int totalScore=0, averageScore=0; for(int i=0;i<size;i++) { totalScore= (totalScore+scores[i]);} averageScore=totalScore/size; cout << "Average Score: " << averageScore; return i;} int main() { int x; //Latifah AlGhanem, Reema AlOumi, Yara AlHussaini// do { cout<<"this program will calculate the avrage of the game score"; string playerNames[100]; int scores[100]; int sizeOfArray=sizeof(scores); int sizeOfEachElement=sizeof(scores[0]); int numberOfElements=sizeOfArray/sizeOfEachElement; cout << numberOfElements<< endl; int numberEntered=inputData(playerNames,scores,numberOfElements); displayPlayerData(playerNames,scores,numberEntered); cin.ignore(); cin.get(); cout<<"if you want to stop please enter '0'"<<endl; cin>>x;} while ( x!=0); } displayPlayerData( playerNames[],scores[], size) cout<<calculateAverageScores<<endl;
13th Apr 2018, 10:33 AM
latifah alghanem
latifah alghanem - avatar
+ 1
i will try upto basics
13th Apr 2018, 10:14 AM
Abhishek Rawat
Abhishek Rawat - avatar
+ 1
i see you code.. what is problem come tell us also.. if you talking about error.. you only forgot to apply parenthesis . or in logic.. https://code.sololearn.com/cB9wjy11WcEU/?ref=app i try to
13th Apr 2018, 11:40 AM
Arun Tomar
Arun Tomar - avatar
0
Oky can you contact me on WhatsApp
13th Apr 2018, 10:23 AM
latifah alghanem
latifah alghanem - avatar
0
Post your code here. You'll get more help.
13th Apr 2018, 10:27 AM
Alex
Alex - avatar
0
Okay I will post it
13th Apr 2018, 10:29 AM
latifah alghanem
latifah alghanem - avatar
0
Okay I will post it
13th Apr 2018, 10:30 AM
latifah alghanem
latifah alghanem - avatar
0
I want to write a code With function and arrays about game system
13th Apr 2018, 10:33 AM
latifah alghanem
latifah alghanem - avatar
0
H
13th Apr 2018, 11:12 AM
latifah alghanem
latifah alghanem - avatar
0
Can I have your email to explain the code to you please me
13th Apr 2018, 12:12 PM
latifah alghanem
latifah alghanem - avatar