สมมุติว่าเราจะเก็บค่ามอนเคลื่อนที่เราจะให้มันส่งคำสั่งย้อนกลับยังไงหรอ อย่างในซีมันจะส่ง2ค่าเป็น[0][72] ในโปรแกรมนี้จะให้มันนส่งค่ากลับยังไงหรอคิดมาหลายวันแล้วอะจึงได้ลองถามหรือว่าต้องส่งค่าทางbitor คือยังไม่เก็จเรื่องการส่ง header ย้อนกลับอะครับงงมาก-*-
2 posters
มีความสงสัยครับ
loveapple244- PSsix Member Super Class II
จำนวนข้อความ : 160
ความนิยม : 9
เข้าร่วมเมื่อ : 15/07/2011
- Post n°1
มีความสงสัยครับ
loveapple244- PSsix Member Super Class II
จำนวนข้อความ : 160
ความนิยม : 9
เข้าร่วมเมื่อ : 15/07/2011
- Post n°2
Re: มีความสงสัยครับ
เนี้ยงับจากส่งกลับยังไง-*-
- 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- PSsix
-
จำนวนข้อความ : 1152
ความนิยม : 326
เข้าร่วมเมื่อ : 19/07/2010
- Post n°3
Re: มีความสงสัยครับ
มีข้อสงสัยหรือสอบถามปัญหาเรื่องการเขียนโปรแกรมภาษาอื่นที่ไม่ใช่ AutoIt ดูได้ตามลิงก์ด้านล่างนี้
[You must be registered and logged in to see this link.]
*หมายเหตุ เอาโค้ดภาษาอื่นมาถาม เพื่อให้ผมตอบหรือแปลงเป็นโค้ด AutoIt ก็ไม่ได้เช่นกัน เพราะผมไม่ได้ชำนาญทุกภาษา
[You must be registered and logged in to see this link.]
*หมายเหตุ เอาโค้ดภาษาอื่นมาถาม เพื่อให้ผมตอบหรือแปลงเป็นโค้ด AutoIt ก็ไม่ได้เช่นกัน เพราะผมไม่ได้ชำนาญทุกภาษา
|
|