Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

why this code does not work right?????my IDE is codeblocks.The answer is diffrent than what i expect.

0 votes
asked Apr 22, 2018 by Pouya (120 points)
#include <iostream>

using namespace std;

class myclass{

    double sum=0;
    public:
    void weder(double arr[],int number);
}mynewproject;

void myclass:: weder(double arr[],int number){
    for(int i=0;i<number;i++)
     sum=sum+arr[i];

     cout<<"meghdare hasel jamee tabe mibashad"<<sum<<endl;
    }

int main(){
const int os=5;
double arr2[os];

mynewproject.weder(arr2,os);

return 0;
}

1 Answer

0 votes
answered Apr 25, 2018 by anonymous
you do't have values in your array  then how could you add that values into variable sum
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...