ฟอรั่ม PSsix

Would you like to react to this message? Create an account in a few clicks or log in to continue.

ฟอรั่มของบล็อก http://pssix.blogspot.com


2 posters

    มีความสงสัยครับ

    avatar
    loveapple244
    PSsix Member Super Class II
    PSsix Member Super Class II


    PSsix Game Coder
    จำนวนข้อความ : 160
    ความนิยม : 9
    เข้าร่วมเมื่อ : 15/07/2011

    มีความสงสัยครับ Empty มีความสงสัยครับ

    ตั้งหัวข้อ by loveapple244 11/11/12, 03:20 pm

    สมมุติว่าเราจะเก็บค่ามอนเคลื่อนที่เราจะให้มันส่งคำสั่งย้อนกลับยังไงหรอ อย่างในซีมันจะส่ง2ค่าเป็น[0][72] ในโปรแกรมนี้จะให้มันนส่งค่ากลับยังไงหรอคิดมาหลายวันแล้วอะจึงได้ลองถามหรือว่าต้องส่งค่าทางbitor คือยังไม่เก็จเรื่องการส่ง header ย้อนกลับอะครับงงมาก-*-
    avatar
    loveapple244
    PSsix Member Super Class II
    PSsix Member Super Class II


    PSsix Game Coder
    จำนวนข้อความ : 160
    ความนิยม : 9
    เข้าร่วมเมื่อ : 15/07/2011

    มีความสงสัยครับ Empty Re: มีความสงสัยครับ

    ตั้งหัวข้อ by loveapple244 11/11/12, 03:23 pm

    เนี้ยงับจากส่งกลับยังไง-*-
    Code:
    #include <iostream>
    #include <cstdlib>
    using namespace std;
    struct Polynomial
    {
    int degree;
    int *coeffs;
    Polynomial();
    };
    Polynomial* readPoly1();
    Polynomial* readPoly2();
    void outputPoly(Polynomial* p,char x);
    Polynomial* addPoly(Polynomial* a,Polynomial* b);
    Polynomial* multPoly(Polynomial* a,Polynomial* b);
    void deletePoly(Polynomial* &p);


    int main()
    {
    Polynomial *a;
    Polynomial *b;
    a = readPoly1();
    b = readPoly2();
    if(a.coeffs == NULL || b.coeffs == NULL)
    {
    cout << "Error: Insuficient memory...exiting program..\n";
    exit(1);
    }

    }

    Polynomial::Polynomial()
    {
    a.degree = 0;
    b.degree = 0;
    a.coeffs = 0;
    b.coeffs = 0;
    }

    Polynomial* readPoly1()
    {
    int deg1;
    int* coefficients1;
    coefficients1 = new int[deg1+1];
    /*------------------------Read in first polynomial--------------------*/
    cout << "Enter degree of first polynomial:";
    cin >> deg1;
    cout << "Enter the coefficients of first polynomial starting with "
    << "the lowest degree term and ending with the highest degree term:";
    for(int i =0;i<deg1+1;i++)
    {
    cin >> coefficients1[i]
    }
    /*---------------------------------------------------------------------*/
    a = new Polynomial;
    a -> degree = deg1;
    a -> coeffs = coefficients1;
    return a;
    }
    Polynomial* readPoly2()
    {
    int deg2;
    int* coefficients2;
    coefficients2 = new int[deg2+1];
    /*------------------------Read in second polynomial--------------------*/
    cout << "Enter degree of second polynomial:";
    cin >> deg2;
    cout << "Enter the coefficients of second polynomial starting with "
    << "the lowest degree term and ending with the highest degree term:";
    for(int i =0;i<deg2+1;i++)
    {
    cin >> coefficients2[i];
    }
    /*----------------------------------------------------------------------*/
    b = new Polynomial;
    b -> degree = deg2;
    b -> coeffs = coefficients2;
    return b;
    }

    POS
    POS
    PSsix
    PSsix


    มีความสงสัยครับ Empty มีความสงสัยครับ Empty มีความสงสัยครับ Empty
    จำนวนข้อความ : 1152
    ความนิยม : 326
    เข้าร่วมเมื่อ : 19/07/2010

    มีความสงสัยครับ Empty Re: มีความสงสัยครับ

    ตั้งหัวข้อ by POS 12/11/12, 06:21 am

    มีข้อสงสัยหรือสอบถามปัญหาเรื่องการเขียนโปรแกรมภาษาอื่นที่ไม่ใช่ AutoIt ดูได้ตามลิงก์ด้านล่างนี้


    [You must be registered and logged in to see this link.]



    *หมายเหตุ เอาโค้ดภาษาอื่นมาถาม เพื่อให้ผมตอบหรือแปลงเป็นโค้ด AutoIt ก็ไม่ได้เช่นกัน เพราะผมไม่ได้ชำนาญทุกภาษา


      เวลาขณะนี้ 19/04/24, 07:01 pm