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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:03:35+00:00 2026-06-14T21:03:35+00:00

Possible Duplicate: error C2248: ‘std::basic_ios<_Elem,_Traits>::basic_ios’ : cannot access private member declared in class ‘std::basic_ios<_Elem,_Traits>’

  • 0

Possible Duplicate:
error C2248: ‘std::basic_ios<_Elem,_Traits>::basic_ios’ : cannot access private member declared in class ‘std::basic_ios<_Elem,_Traits>’

error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'

What I’m supposed to be doing with this code is opening two file, reading the files, calculating the mean and standard deviation from the numbers inside of that file with functions and arrays. So, I am getting this error and I’m not really sure what is wrong with my code. I’m not really sure what is wrong with the code but it could possible be the functions? My friend took a look at my code and got that error but it wasn’t there before. Am I supposed to do a reference somewhere but I made it a value instead? Could anyone help? Sorry if I did something wrong while making this post.

#include <iostream>
#include <fstream>
#include <cmath>
#include <string> 
#include <iomanip>
using namespace std ;
bool open(ifstream &A_bank, ifstream &B_bank) ;
void read(ifstream &A_bank, ifstream &B_bank, string &n1, string& n2, int &i, int& j,  float &num, float &num1, float &total, float &total1, float counter, float counter1);
void avg(float &mean, float &mean1, float total, float total1, int i, int j);
void print(ifstream A_bank, ifstream B_bank, float mean, float mean1, string n1, string n2);
int main()
 {
    //Declaring variables.
    ifstream A_bank, B_bank ;
    string n1,n2;
    int i, j, a[20], b[20] ;
    float num=0, num1=0, total=0, total1=0, stdev=0,stdev1=0, mean=0, mean1=0, counter, counter1 ;

    open(A_bank, B_bank) ;
    read(A_bank, B_bank, n1, n2, i, j, num, num1, total, total1, counter, counter1) ;
    avg(mean, mean1, total, total1, i, j) ;
    print(A_bank, B_bank, mean, mean1, n1, n2) ;
    return 0;
 }

bool open(ifstream &A_bank, ifstream &B_bank)
{

    string n1, n2;
    cout << "Enter file name: " ;
    getline(cin, n1) ;
    A_bank.open(n1.c_str()) ; 
    if (A_bank.eof())
    {
        cout << "File is empty" << endl ;
        return false ;
    }

    //Verify that the correct file name was entered.
    else if (A_bank.fail())
    {
        cout << "File could not be opened." << endl ;
        return false ;
    }

    cout << "Enter file name of second bank: " ;
    getline(cin, n2) ;
    B_bank.open(n2.c_str()) ;
    if (B_bank.eof())
    {
        cout << "File is empty" << endl ;
        return false ;
    }
    else if (B_bank.fail())
    {
        cout << "File could not be opened." << endl ;
        return false ;
    }
    return true ;
}



//Reading the files
void read(ifstream &A_bank, ifstream &B_bank, string &n1, string& n2, int &i, int& j, float &num, float &num1, float &total, float &total1, float counter, float counter1, int a[], int b[])
{
    getline(A_bank,n1);
    for(int i=0; !A_bank.eof();i++)
    {
        A_bank>>a[i];
        total+=a[i];
        counter++;
    }
    getline(B_bank,n2);
    for(int j=0; !B_bank.eof();j++)
    {
        B_bank>>b[j];
        total+=b[j];
        counter1++;
    }
}

//Calculations
void avg(float &mean, float &mean1, float total, float total1, int i, int j)
{
    mean = (total) / (i) ;
    mean1 = (total1) / (j) ;
}
  • 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-14T21:03:36+00:00Added an answer on June 14, 2026 at 9:03 pm

    In print() you’re trying to copy an ifstream object, which is not possible. Use ifstream& instead:

    void print(ifstream &A_bank, ifstream &B_bank, float mean, float mean1, string n1, string n2);
    

    According to std::basic_ifstream::basic_ifstream moving is possible with C++11.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: PHP error: Cannot modify header information – headers already sent I've built
Possible Duplicate: Fatal error: Cannot use object of type stdClass as array in Please
Possible Duplicate: Syntax error while defining an array as a property of a class
Possible Duplicate: PHP Fatal error: Call to a member function Execute() on a non-object
Possible Duplicate: Error while adding records to access database from c#.net I need to
Possible Duplicate: error: writable atomic property cannot pair a synthesized setter/getter with a user
Possible Duplicate: Error “No known class method for selector 'Hello:'” in custom-made framework I
Possible Duplicate: Confusing Template error I have a templated class with a templated method.
Possible Duplicate: Error calling template method in templated-base-class The following code compiles with MSVC10
Possible Duplicate: Error with address of parenthesized member function In this recent question the

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.