Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8193901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:38:23+00:00 2026-06-07T04:38:23+00:00

My plan was to make a simple addition calculator, and move on from there.

  • 0

My plan was to make a simple addition calculator, and move on from there.
Remember, this is my first day coding.

#include <iostream>
#include <string>

using namespace std;

int a;
int b;
int sum;
string ans;

class CalcClass{
public:
    int add (int a, int b) {
        cout << "Pick the numbers you want to add" << endl;
        cin >> a >> b;
        sum = a + b;
        return sum;
    }
};

Added string ans; (at the top). Now I’m getting an "error: no matching function for call to 'CalcClass::add()'"

Why would it be saying this if I already created calcObject and used calcObject.add(); to call the function?

void pickFunction(){
    cout << "What Function do you want to do? \n Add, Subtract, multiply, or divide? ";
    cin >> ans;

    if (ans == "add"){
        CalcClass calcObject;
        calcObject.add();
    }


int main(){
    pickFunction();

    cout << "Your answer is : " << sum << endl;
    return 0;
}   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:38:25+00:00Added an answer on June 7, 2026 at 4:38 am

    ans needs a type (probably string), add needs quotes ("add"), CalcClass.calcObject; needs to be CalcClass calcObject;.

    ‘dot’ syntax (x.y) is used for accessing data or functions that are stored inside of an object, not a class (e.g. calcObject.add(); rather than CalcClass.add();).

    Also, as Mahesh says, pickFunction(); needs to be in main. This should look as follows:

    void pickFunction(){
        //code
    }
    int main() {
        pickFunction();
        //...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm coding simple game which I plan to make multiplayer (over the network) as
I would like to make a simple plan: I did something like this: CREATE
This seems like a simple problem, but the more I plan it out, the
I plan to make an pretty big application on Facebook. Would it be a
I plan on building a simple, yet high usage webapp and need to settle
I've been trying to make a little simple game just to test my logics,
I wrote a simple httpserver which i plan to interact with with HttpRequest/Response. The
I have a problem with a relatively simple query and the execution plan Access
This may be kind of a simple question, but I haven't seen a direct
I'm trying to develop a simple IRC bot. First I want to think out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.