Results 1 to 4 of 4

Thread: complie ไม่ผ่านอ่ะ ช่วยหนอ่ยคับ

  1. #1


    #include <iostream>
    #include <conio.h>
    #include <string.h>
    #define MAX 10

    using namespace std;

    template <class Type>
    class stack{
    int top;
    Type data[MAX];

    public :
    stack() {top=-1;}
    ~stack();
    int Push(Type what){
    if(top<MAX-1){
    cout << "empty" << endl;
    return -1;
    }
    top++;
    data[top]=what;
    return 1;
    }
    Type pop(){
    Type temp;
    if(top==-1){
    cout << "overflowe" << endl;
    }
    temp = data[top];
    top--;
    return temp;
    }
    bool Isempty(){
    if(top==-1) return true;
    else
    return false;
    }
    bool Isfull(){
    if (top==MAX) return true;
    else
    return false;
    };

    void main(){
    struct information{
    int name;
    int lastname;
    };
    stack <information> st;

    information info;
    information info1;
    info.name=1;
    info.lastname=2;
    st.Push(info);
    info1=st.pop();
    cout<< info1.name << info1.lastname << endl;

    }
    };


    error [Linker error] undefined reference to `WinMain@16&#39;
    ld returned 1 exit status

  2. #2
    Member
    Join Date
    Aug 2007
    Location
    Thailand
    Posts
    79


    ... ดูแล้วงงๆ ถ้าไงช่วย Comment + จัดบรรทัดหน่อยจะดีมากเลยครับ
    <div align="center">[SIZE=1][color=#33CCFF]+ :: A little knowledge is dangerous. การรู้เรื่องอย่างนึ่งเพียงน้อยนิดอาจจะทำให้พลาดพลั้งได้ :: +[/color][/SIZE]</div>

  3. #3


    มันเป็นโค๊ด template stack ครับ แล้วผมก็เอามาใช้เก็บข้อมูล structur อ่ะ พอคอมไพล์มันเหมือนจะผ่าน แต่บอกว่า มีปัญหากับการส่ง ลิงค์ อ่ะ ก็เลยไม่รุตรงไหน

  4. #4
    Member
    Join Date
    Aug 2007
    Location
    Thailand
    Posts
    79


    อืม .. ผมดูแล้วก็ งงๆ ไม่ได้เรียน Template มาแต่เหมือนมันจะใส่ { } ผิดอ่ะน่ะ

    [code]
    #include <iostream>
    #include <conio.h>
    #include <string.h>
    #define MAX 10

    using namespace std;

    template <class Type>
    class stack
    {
    <div align="center">[SIZE=1][color=#33CCFF]+ :: A little knowledge is dangerous. การรู้เรื่องอย่างนึ่งเพียงน้อยนิดอาจจะทำให้พลาดพลั้งได้ :: +[/color][/SIZE]</div>

Similar Threads

  1. การ Complie ไฟล์ภาษา C
    By obiconbig in forum แนะความรู้ด้าน Programming ต่างๆ
    Replies: 0
    Last Post: 18-06-2008, 02:37 PM

Members who have read this thread : 0

Actions : (View-Readers)

There are no names to display.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •