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 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

Ok, I think whatever I'm doing wrong, it's probably blindingly obvious, but I can't
Sorry for asking an complete n00b question, but I've tried everything I can think
Yet another IE is doing something different from other browsers question but this is
I think I'm doing everything right to first create a folder that I can
I think I'm missing something fundamental and so I want to ask the community
I have couchdb. Sunspot was correctly indexing everything. But the Solr server crashed. I
I'm doing ray casting in the fragment shader. I can think of a couple
I'm used to doing Java programming, where you never really have to think about
I can't see what I'm doing wrong. I think it might be one of
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#regroup I can think of a few ways of doing it with loops but

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.