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 8636929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:21:01+00:00 2026-06-12T10:21:01+00:00

Please have a look at the following code #include <iostream> #include <iomanip> #include <vector>

  • 0

Please have a look at the following code

#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

bool multiple(int,int);
void isMul(vector);


vector <int> numbers;
int enterNumber = 0;



int main()
{
    cout << "Enter numbers (-1 to stop entering; -2 to exit)" << endl;

    cin >> enterNumber;

    while(true)
    {
        if(enterNumber==-1)
        {
            isMul(numbers);
            break;
        }
        else
        {
                numbers.push_back(enterNumber);
                cin >> enterNumber;
        }
    }
}



bool multiple(int number1, int number2)
{
    if(number2%number1 == 0)
    {
        return true;
    }
    else
    {
        return false;
    }
}

void isMul(vector numbers)
{
    cout << "First Number" << setw(10) << "Second Number" << setw(10) << "isMultiplication" << endl;

    for(size_t size=0;size<numbers.size();size+2)
    {
        cout << numbers[size] << setw(12) << numbers[size+1] << setw(12) << multiple(size,size+1);
    }
}

I am getting the following error when I run this code

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/yohan/Documents/NetBeansProjects/Excersice 6.1'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/excersice_6.1.exe
make[2]: Entering directory `/cygdrive/c/Users/yohan/Documents/NetBeansProjects/Excersice 6.1'
mkdir -p build/Debug/Cygwin-Windows
rm -f build/Debug/Cygwin-Windows/Multiple.o.d
g++    -c -g -MMD -MP -MF build/Debug/Cygwin-Windows/Multiple.o.d -o build/Debug/Cygwin-Windows/Multiple.o Multiple.cpp
Multiple.cpp:8: error: variable or field `isMul' declared void
Multiple.cpp:8: error: missing template arguments before ')' token
Multiple.cpp: In function `int main()':
Multiple.cpp:26: error: `isMul' cannot be used as a function
Multiple.cpp: At global scope:
Multiple.cpp:51: error: variable or field `isMul' declared void
Multiple.cpp:51: error: redefinition of `int isMul'
Multiple.cpp:8: error: `int isMul' previously defined here
Multiple.cpp:51: error: missing template arguments before "numbers"
Multiple.cpp:52: error: expected `,' or `;' before '{' token
make[2]: *** [build/Debug/Cygwin-Windows/Multiple.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
nbproject/Makefile-Debug.mk:71: recipe for target `build/Debug/Cygwin-Windows/Multiple.o' failed
make[2]: Leaving directory `/cygdrive/c/Users/yohan/Documents/NetBeansProjects/Excersice 6.1'
nbproject/Makefile-Debug.mk:59: recipe for target `.build-conf' failed
make[1]: Leaving directory `/cygdrive/c/Users/yohan/Documents/NetBeansProjects/Excersice 6.1'
nbproject/Makefile-impl.mk:39: recipe for target `.build-impl' failed


BUILD FAILED (exit value 2, total time: 1s)

Why is this? I am new to C++ anyway. Please help!

  • 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-12T10:21:03+00:00Added an answer on June 12, 2026 at 10:21 am

    The problem is you haven’t given a type for vector in:

    void isMul(vector);
    

    If you want a specific type like ints you need:

    void isMul(vector<int>);
    

    If you want to template it you should do:

    template<class T> void isMul(vector<T>);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please have a look at the following code #include <iostream> #include <iomanip> #include <vector>
i have following code for heapsort #include <iostream> using namespace std; void exch(int a[],int
Please have a look at the following code. Main.cpp #include <iostream> #include Maximum.h using
Please have a look at the following code #include <iostream> #include <iomanip> #include <cmath>
Please have a look at the following code namespace Funny { class QuesionsAndAnswers {
Please have a look at the following code: #include <stdio.h> #include <stdlib.h> typedef struct
Have a look at the following code snippet... File1.h void somefunc(int); File1.c #include File1.h
Please have a look at the following code. I am using Apache Derby as
I have the following code: #include <iostream> #include <string> void main() { std::string str;
Please have a look at the following code int main() { cout << Enter

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.