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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:19:39+00:00 2026-06-11T18:19:39+00:00

#include <iostream> #include <iomanip> using namespace std; int main () // print to console:

  • 0
#include <iostream>
#include <iomanip>
using namespace std;

int main () // print to console: 3.0*5.0=15.00
{
double a;
double b;
a =(3.0);
b =(5.0);
cout << "  " << fixed << setprecision (1) << a << "\n" << endl;
cout << "* " << b << "\n" << endl;
cout << "------" << endl;
cout << fixed << setprecision (2) << a*b << "\n" << endl;

return 0;
}

int calculate (int a, int b, int c) // print to console: (7.1*8.3)-2.2=56.73
{
double a;
    double b;
    double c;
    a = (7.1);
    b = (8.3);
    c = (2.2);
    cout << "  " << fixed << setprecision (1) << a << "\n" << endl;
    cout << "* " << b << "\n" << endl;
    cout << "- " << c << "\n" << endl;
    cout << "------" << endl;
    cout << setprecision(2) << (a*b)-c << "\n" << endl;
}
int calculation (int a, int b, int c) // print to console: 3.2/(6.1*5.0)=0.10
{
double a;
double b;
double c;
a=(3.2);
b=(6.1);
c=(5.0);
cout << "  " << fixed << setprecision (1) << a << "\n" << endl;
    cout << " /(6.1*5.0)" << endl; //how can I use variables instead of using quotes?
cout << "------" << endl;
cout << setprecision(2) << a/(b*c) << "\n" << endl;

system("PAUSE");

return 0;
}

I have used a repetitive layout that I was hoping would print 3 functions vertically so that decimals all line up. I cannot seem it to get to print without errors and think I don’t understand the error outputs enough to make necessary changes. I don’t know if I am redefining the variables properly or if I am putting them together properly (using {}).

Thanks to anyone who can help me get this to work.

Here is the output:

(7): error C2082: redefinition of formal parameter 'a'
(8): error C2082: redefinition of formal parameter 'b'
(9): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
(10): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
(21): error C2082: redefinition of formal parameter 'a'
(22): error C2082: redefinition of formal parameter 'b'
(23): error C2082: redefinition of formal parameter 'c'
(24): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
(25): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
(26): warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
(34): error C2601: 'calculation' : local function definitions are illegal
(20): this line contains a '{' which has not yet been matched
(51): fatal error C1075: end of file found before the left brace '{'

How would I fix these errors?

  • 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-11T18:19:40+00:00Added an answer on June 11, 2026 at 6:19 pm

    First of all:

    int main(int, int) – very non-standard program entry point

    Next one :

    int main (int a, int b) // print to console: 3.0*5.0=15.00
    {
    double a;
    double b;
    

    You are redefining formal parameters a and b

    That’s it, this is what your compiler is saying:

    (7): error C2082: redefinition of formal parameter 'a'
    (8): error C2082: redefinition of formal parameter 'b'
    

    .

    int calculate (int a, int b, int c) // print to console: (7.1*8.3)-2.2=56.73
    {
    double a;
        double b;
        double c;
    

    You have same local variables and formal parameter names, I don’t think this is what you are expecting.

    And last one:

    You are missing closing bracket “}” at the end of calculate function.

    #include <iostream>
    #include <iomanip>
    using namespace std;
    
    int main () // print to console: 3.0*5.0=15.00
    {
    double a;
    double b;
    a =(3.0);
    b =(5.0);
    cout << "  " << fixed << setprecision (1) << a << "\n" << endl;
    cout << "* " << b << "\n" << endl;
    cout << "------" << endl;
    cout << fixed << setprecision (2) << a*b << "\n" << endl;
    
    return 0;
    }
    
    int calculate () // print to console: (7.1*8.3)-2.2=56.73
    {
        double a;
        double b;
        double c;
        a = (7.1);
        b = (8.3);
        c = (2.2);
        cout << "  " << fixed << setprecision (1) << a << "\n" << endl;
        cout << "* " << b << "\n" << endl;
        cout << "- " << c << "\n" << endl;
        cout << "------" << endl;
        cout << setprecision(2) << (a*b)-c << "\n" << endl;
    }
    int calculation () // print to console: 3.2/(6.1*5.0)=0.10
    {
        double a;
        double b;
        double c;
        a=(3.2);
        b=(6.1);
        c=(5.0);
        cout << "  " << fixed << setprecision (1) << a << "\n" << endl;
        cout << b << "*" << c << endl; //how can I use variables instead of using quotes?
        cout << "------" << endl;
        cout << setprecision(2) << a/(b*c) << "\n" << endl;
    
        system("PAUSE");
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <iostream> #include <iomanip> using namespace std; int main () // print to console:
#include <iostream> #include <iomanip> using namespace std; double distance(double, double); int main () {
#include <iostream> #include <iomanip> using namespace std; int main() { char array[10]; for(int i
#include<iostream> #include<fstream> #include<cstdlib> #include<iomanip> using namespace std; int main() { ifstream in_stream; // reads
#include <iostream> using namespace std; int main() { int a, b, c, max; cout<<a=;
#include <iostream> #include <string.h> using namespace std; int main() { int e=0; int b=0;
#include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <string> using namespace std; int
Here is my code: #include <iomanip> #include <fstream> #include <iostream> using namespace std; int
#include stdafx.h #include <iomanip> #include <iostream> #include <fstream> using namespace std; void FillArray (int
#include <iostream> #include <string> using namespace std; string crash() { } int noCrash() {

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.