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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:32:24+00:00 2026-05-20T15:32:24+00:00

I think i am doing everything correctly…..but obviously i am missing something, my while

  • 0

I think i am doing everything correctly…..but obviously i am missing something, my while statement doesn’t seem to ever get entered. Please help….

#include <iostream>
using namespace std;


void swap(int *aPtr, int *bPtr)
{
    int holder=0;
    holder=*aPtr;
    *aPtr=*bPtr;
    *bPtr=holder;
}
void instantiator(int *dPtr,int *xPtr,int *yPtr,int a)
{
    *dPtr=a;
    *xPtr=1;
    *yPtr=0;
}
void cruncher(int *xPtr,int *dPtr, int *aPtr,int *yPtr,int *bPtr)
{
    int x1=0,x2=1,y1=1,y2=0,r=0,q=0;
    while(*bPtr>0)
        {
            q=*aPtr/(*bPtr);
            r=*aPtr%*bPtr;
            *xPtr=x2-(q*x1);
            *yPtr=y2-(q*y1);
            *aPtr=*bPtr;
            *bPtr=r;
            x2=x1;
            x1=*xPtr;
            y2=y1;
            y1=*xPtr;
            cout<<q<<" "<<r<<" "<<*xPtr<<" "<<*yPtr<<" "<<*aPtr<<" "
                <<*bPtr<<" "<<x2<<" "<<x1<<" "<<y2<<" "<<y1<<endl;
            }
    cout<<endl;
    *dPtr=*aPtr;
    *xPtr=x2;
    *yPtr=y2;

}
int main() {
    int a=4864,b=3458,d,*aPtr,*bPtr,*dPtr,x,*xPtr,y,*yPtr;
    aPtr=&a;
    bPtr=&b;
    dPtr=&d;
    xPtr=&x;
    yPtr=&y;

    if(b=0)
        instantiator(dPtr,xPtr,yPtr,a);

    if (a<b)
        swap(aPtr,bPtr);

    cruncher(xPtr,dPtr,aPtr,yPtr,bPtr);
    cout<<d<<" "<<x<<" "<<y;


    return 0;
}
  • 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-20T15:32:25+00:00Added an answer on May 20, 2026 at 3:32 pm

    The test in your while loop is *bPtr > 0, yet you set b to 0 in main (using if (b=0)) and then pass a pointer to it as bPtr. Try fixing the if statement in main and see if that changes the behavior.

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

Sidebar

Related Questions

I'm used to doing Java programming, where you never really have to think about
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#regroup I can think of a few ways of doing it with loops but
I think this is specific to IE 6.0 but... In JavaScript I add a
I think that java executables (jar files) are trivial to decompile and get the
One thing I've started doing more often recently is retrieving some data at the
I am doing the exact same thing in two classes, and in one the
I think the file that is produced is an .asm file, any idea how
I think most people know how to do this via the GUI (right click
I think most people here understand the importance of fully automated builds. The problem
I think it can be done by applying the transformation matrix of the scenegraph

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.