Post: need some help on this c++ code
05-04-2017, 06:20 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Okay i figured out the problem..what i was trying to do is add variables through classes and objects for anyone with the same problem use this code for an example

    #include <iostream>
using namespace std;
class calculator{
public:
int setadd(int x,int y){
answer=x+y;
}
int getadd(){
return answer;
}
private:
int answer;
};
int main(){
calculator bo;
bo.setadd(30,7);
cout<<bo.getadd();
return 0;
}
Last edited by mudville209 ; 05-06-2017 at 05:22 PM.
05-06-2017, 01:52 PM #11
but if u look at the post it says edited by kronos
05-06-2017, 04:53 PM #12
Your very first post didn't include the full code. You don't even read what I write, you copy paste the code thinking it works and you come back there complaining. How do you want people do give you advices when you don't read what they write? The code once corrected does work. Besides asking for help just saying "it doesn't work" won't get you anywhere.
05-06-2017, 05:00 PM #13
i read what u said i just didnt understand

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo