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

  • Home
  • SEARCH
  • 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 7593793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:15:28+00:00 2026-05-30T21:15:28+00:00

I made a program which converts n decimal numbers sk into other numerical system

  • 0

I made a program which converts n decimal numbers sk into other numerical system p but sometimes it crashes and the error code I get is 0xC0000005 (program still converts and outputs all the numbers) . One thing I just noticed that it happens then converted number is longer than 6 symbols (or it’s just a coincidence).

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()
{
    long n,sk,p,j;
    string liekanos;
    ifstream f("u1.txt");
    f >> n;
    for (int i=0;i<n;i++)
    {
        f >> sk >> p;
        j=0;
        while (sk>0)
        {
            liekanos[j]=sk % p;
            sk/=p;
            j++;
        }
        for (j>=0;j--;)
        {
            if (liekanos[j]<10)
                cout<<int(liekanos[j]);
            else cout<<char(liekanos[j]+55);
        }
        cout<<endl;
    }
    return 0;
}

Example input:

3
976421618 7
15835 24
2147483647 2
  • 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-30T21:15:29+00:00Added an answer on May 30, 2026 at 9:15 pm

    With liekanos[j] you access element at index j but since you haven’t specify size of this string, you are most likely trying to access non-existing element. You could call liekanos.resize(sk) before you enter your while loop to make sure it never happens.

    Or if you know the maximum possible size of liekanos, you could declare it as string liekanos(N, c); where N is its size and c is the default value of each character in it.

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

Sidebar

Related Questions

I have made a program which converts numbers entered into a string into an
i made a program which converts lower case to upper case a string.i know
I made a program which uses a filesystemwatcher component, but it seems to record
I made a program which stores a structure in a file but the output
Alright, I made a program which should work, but unfortunately doesn't. It loads a
I've made a small program which has 2 buttons and each does certain thing.
I made a program. I also made my own file type, which the program
I made a program which removes spaces and makes a string upper case by
I have made a program which is a small library operated via software. When
I have just made a program which calculates pi. However, even with 10 million

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.