Facebook
From Putrid Cassowary, 4 Years ago, written in Plain Text.
This paste is a reply to Untitled from Commodious Terrapin - go back
Embed
Viewing differences between Untitled and Re: Untitled
#include 
using namespace std;

struct nwda{
        int a, b, nwd;
};
void a(){
        nwda a1;
        cout<<"Podaj liczbe a: ";
        cin>>a1.a;
        cout<<"Podaj liczbe b: ";
        cin>>a1.b;
        
        while(a1.a!=a1.b)
       if(a1.a>a1.b)
           a1.a-=a1.b;
       else
           a1.b-=a1.a;
    a1.nwd = a1.a;
    cout<<"NWD = "< }

struct nwdb{
        int a, b, nwd;
        void ab();
};
void nwdb::ab(){
        cout<<"Podaj liczbe a: ";
        cin>>a;
        cout<<"Podaj liczbe b: ";
        cin>>b;
        
        while(a!=b)
       if(a>b)
           a-=b;
       else
           b-=a;
    nwd = a;
    cout<<"NWD = "< }

int main() {
        a();
        system("pause");
        nwdb b1;
        b1.ab();
        system("pause");
}