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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:41:13+00:00 2026-05-23T13:41:13+00:00

I get this error in the debugging mode when i first encounter the marked

  • 0

I get this error in the debugging mode when i first encounter the marked line in the code below

#include<fstream>
#include<iostream>
#include<math.h>
#include<string>

using namespace std;

int main()
{int t,i,j,k,n,g[100],w[100],opp[100];
float rpi[100],wp[100],owp[100],oowp[100];
char s[100][100];
ifstream ip; ip.open("A-small-practice.in"); ofstream op; op.open("A_out.in");
ip>>t; 
for(i=0;i<t;i++)
  { ip>>n;
    memset(g,0,sizeof(g));
    memset(w,0,sizeof(w));
    memset(op,0,sizeof(op));
    memset(rpi,0,sizeof(rpi));
    memset(wp,0,sizeof(wp)); 
    memset(owp,0,sizeof(owp));
    memset(oowp,0,sizeof(oowp));
    memset(s,'.',sizeof(s));

    for(j=0;j<n;j++)
      {for(k=0;k<n;k++)
        {ip>>s[j][k]; //<--------------------the error occurs here
        if(s[j][k]=='0')
          g[j]++;
    if(s[j][k]=='1')
      {g[j]++;w[j]++;}
        }
      wp[j]=w[j]/g[j];
     }

    for(j=0;j<n;j++)
      {for(k=0;k<n;k++)
       if(j!=k && s[k][j]!='.')
           {owp[j]+=(wp[k]*g[k]-s[k][j])/(g[k]-1);
           opp[j]++;
           }
       owp[j]/=opp[j];
      } 

    for(j=0;j<n;j++)
      {for(k=0;k<n;k++)
        {if(j!=k && s[k][j]!='.')
         oowp[j]+=owp[k];
        }
       oowp[j]/=opp[j]; 
      }

   op<<"Case #"<<i+1<<": \n"; 
    for(j=0;j<n;j++)
    {rpi[j]=(0.25*wp[j]) + (0.5*owp[j]) +(0.25*oowp[j]);
    op<<rpi[j]<<"\n";
     } 
 } 
return 0; 
}

the debugger breaks at this code segment when stepped in. The loops and logic the value size is all correct i don’t know where the overflow is ocurring..is there any other cause for this?

    class _Sentry_base
    {   // stores thread lock and reference to input stream
public:
    __CLR_OR_THIS_CALL _Sentry_base(_Myt& _Istr)
        : _Myistr(_Istr)
        {   // lock the stream buffer, if there
        if (_Myistr.rdbuf() != 0)//<-------------break points here
            _Myistr.rdbuf()->_Lock();
        }
  • 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-05-23T13:41:14+00:00Added an answer on May 23, 2026 at 1:41 pm

    You don’t need to use memset for the 1D arrays. For example

     int g[100] = {0};
    

    will work.

    For the 2D array, loop through using a for loop and set each element to '.', or stick with the memset for that step.

    In terms of your actual problem, you may need to use ip.get() to read character by character instead.

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

Sidebar

Related Questions

I get this error when debugging my ASP.NET web application after I trigger an
When I am debugging on my Windows 7 IIS7 machine, I get this error
I get this error in debugger and its preventing a debugging. unable to load
I get this error after debugging in Eclipse. The debug is successful though. ERROR:
I get this error: Can't locate Foo.pm in @INC Is there an easier way
I get this error on an update panel within a popupControlExtender which is within
I get this error when I do an svn update : Working copy XXXXXXXX
I get this error:- You have an error in your SQL syntax; check the
We get this error in Visual Studio 2005 and TFS very often. Can anyone
i get this error {Method 'System.DateTime ConvertTimeFromUtc(System.DateTime, System.TimeZoneInfo)' has no supported translation to SQL.}

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.