Hay everyone I need help
I have project in subject programming languages about make one idea on two languages c and java .
I have made it in java but I couldn't in c
this is the code in java

Class Link
// Link.java
// to run this program: C>java Main
//--------------------------------------------------------------
class Link
   {
public String bookName;              // data item
publicintBookID;           // data item
public String State;
public Link next;              // next link in list

// -------------------------------------------------------------
public Link(String BN,intID,String state) // constructor
      {
bookName= BN; 
BookID = ID; 
        State=state;
      }                           //  set to null)
// -------------------------------------------------------------
public void displayLink()      // display ourself
      {
System.out.print("" + BookID + " " + bookName +"\n ");
      }
public void displaystate()      // display ourself
      { 
System.out.print(" " + BookID + " " + bookName +"\t \t \t"+State+"\n ");
System.out.println("--------------------------------------------------------------------------");     
      }  
}  // end class Link
////////////////////////////////////////////////////////////////

Class LinkList
// linkList.java
// demonstrates linked list
// to run this program: C>java Main
////////////////////////////////////////////////////////////////
classlinkList
   {
private Link first; // ref to first link on list
private Link last; 
// -------------------------------------------------------------
publiclinkList()              // constructor
      {
first = null;               // no links on list yet
last= null;
      }
//---------------------------------------------------------------------------------
public void insert(String BN,intID,String state)        // insert, in order
      {
       Link newLink = new Link(BN, ID,state);    // make new link
      Link previous = null;            // start at first
      Link current = first;
                                       // until end of list,
while(current != null && ID >current.BookID)
         {                             // or key > current,
previous = current;
current = current.next;       // go to next item
         }
if(previous==null)               // at beginning of list
first = newLink;              // first -->newLink
else                             // not at beginning
previous.next = newLink;      // old prev -->newLink
newLink.next = current;          // newLink --> old currnt
      } 
// -------------------------------------------------------------
public Link find(int key)      // find link with given key
      {                           // (assumes non-empty list)
      Link current = first;              // start at 'first'
while(current.BookID != key)        // while no match,
         {
if(current.next == null)        // if end of list,
return null;                 // didn't find it
else                            // not end of list,
current = current.next;      // go to next link
         }
return current;                    // found it
      }
// -------------------------------------------------------------
public Link delete(int key)    // delete link with given key
      {                           // (assumes non-empty list)
      Link current = first;              // search for link
      Link previous = first;
while(current.BookID != key)
         {
if(current.next == null)
return null;                 // didn't find it
else
            {
previous = current;          // go to next link
current = current.next;
            }
         }                               // found it
if(current == first)               // if first link,
first = first.next;             //    change first
else                               // otherwise,
previous.next = current.next;   //    bypass it
return current;
      }
// -------------------------------------------------------------
public void displayList()
      {
System.out.println("List of books:");
      Link current = first;       // start at beginning of list
while(current != null)      // until end of list,
         {
current.displayLink();   // print data
current = current.next;  // move to next link
         }
System.out.println("");
      }
// -------------------------------------------------------------
public void displayState(Link key)
      {
System.out.println("state of books:");
System.out.println(" ID              Book Name                                  State         ");
System.out.print("-------------------------------------------------------------------------\n");
      Link current = first;       // start at beginning of list
while(current != key)      // until end of list,
         {
current = current.next;  // move to next link
         }
current.displaystate();
System.out.println("");
    }
// -------------------------------------------------------------
public void displayStateall(Link key)
      {
System.out.println("list after EDIT:>");
System.out.println("state of books:");
System.out.println(" ID              Book Name                                  State         ");
System.out.print("-----------------------------------------------------------------------\n");
      Link current = first;       // start at beginning of list
while(current != null)      // until end of list,
         { 
current.displaystate();
current = current.next;  // move to next link     
         }  
System.out.println("");}
// -------------------------------------------------------------
public Link seAv(int key)      
      {     
      Link current = first;       // start at beginning of list
while(current.BookID != key)      // until end of list,
         {
current = current.next;  // move to next link
         }
if(current.State=="Available")
         {
current.State="Not Avaliable";
current.displaystate();
         }
else{
current.State="Not Avaliable";
current.displaystate();}

System.out.println("");
return current;}
//---------------------------------------------------------------      
public Link seNAv(int key)      
      {   
      Link current = first;       // start at beginning of list
while(current.BookID != key)      // until end of list,
         {
current = current.next;  // move to next link
         }
if(current.State=="Not Available")
         { 
current.State="Avaliable";
current.displaystate();
         }
else
   {
current.State="Avaliable";
current.displaystate();
    }

System.out.println("");
return current;
}//end seNAv
}//end class linkList


Class Main






//Data Structure project-YUC
//Electronic Quick Library System
//programmed by :Wafaalshaikh&WijdanAljohani
//-------------------------------------------------------------------------------------Backages
importjava.awt.Component;
importjava.awt.FlowLayout;
importjava.awt.HeadlessException;
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjavax.swing.JButton;
importjavax.swing.JFrame;
importjavax.swing.JOptionPane;
importjavax.swing.JPanel;
importjava.util.*;
importjava.util.Scanner;
importjava.awt.*;
importjava.awt.event.*;
importjavax.swing.*;
importjavax.swing.border.*; 
importjava.text.*;
importjava.util.Scanner;
importjavax.swing.JOptionPane;
//--------------------------------------------------------------------------------------Class Main
public class Main extends JFrame
{     
//-----------------------------------------------------------------------------------1--Method main  
public static void main(String[] args)
  {   
new Main().setVisible(true);//call method Main   
  }//end public static void main
//----------------------------------------------------------------------------------2--Mathod Main
public Main() 
  {
finallinkListtheList = new linkList();
final Scanner input = new Scanner(System.in);
      ////////////////////////////
theList.insert("Algorithms and Complexity ", 1,"Available");      // insert 10 books
theList.insert("The Assembly Language Database ", 2,"Available");
theList.insert("C++ Coding Standard ", 3,"Available");
theList.insert("Introduction To OOP Using C++ ",4,"Available");
theList.insert("CGI Programming on the World Wide Web",5,"Available");
theList.insert("MySQL Reference Manual",6,"Available");
theList.insert("Practical PHP Programming",7,"Available");
theList.insert("Comparison of Different SQL Implementations",8,"Available");
theList.insert("Introducing Visual Basic 2005 for Developers",9,"Available");
theList.insert("Introduction To Structured Query Language  ",10,"Available");
     /////////////////
setTitle("EQLS");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//---------------------------------------------------------------------------Date-Photo-size-color
         Date da = new Date();
         Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.setBackground(Color.orange);
setSize(600, 600);
         //-------------------
JLabel time = new JLabel("Today is:" +da);
getContentPane().add(time);
         //----------------
setResizable(false);		
setLocationRelativeTo(null); 	
         String imgStr1 = "c://EQLS.png";
ImageIcon image = new ImageIcon(imgStr1);	
JLabel label1 = new JLabel(" ", image, JLabel.CENTER);
getContentPane().add(label1);
validate();	
setVisible(true);
         //------------------

//-----------------------------------------------------------------------------------------Button1
JButton button1 = new JButton("Welcom to [ Electronic Quick Library System ]");
button1.addActionListener(new ActionListener() {   public void actionPerformed(ActionEvent e) 
      {
JOptionPane.showMessageDialog((Component) e.getSource(), "\n\n EQLS: [ Electronic Quick Library System ] \n\n [ System provides a quick services for books to student and teachers in Yanbu Uneversiy College ] \n\n [ Programmed by: Wijdan Al-Johani& Wafa'a Al-Shaikh ]\n\n [ This system is a project of Data Structure Subject ]\n\n [ 2001 ]\n\n");
       }
    });//end button1
//-----------------------------------------------------------------------------------------Button2
JButton button2 = new JButton("Main User Access: Librarian");
button2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e)
      { 
          String Option1 = JOptionPane.showInputDialog(null,"\n1-Show List of bookes\n2-Add new book\n3-Remove book from list\n4-Borrow\n5-Return\n6-Exit\n\nEnter a number of service", "Librarian Options", JOptionPane.INFORMATION_MESSAGE);
int ConvOption1 = Integer.parseInt(Option1);
while(ConvOption1!=6)
    {
switch (ConvOption1)
       {
case 1:{
theList.displayList();
              }
break;
case 2:{
              String name = JOptionPane.showInputDialog((Component) e.getSource(), "Enter Name of the Book:");
              String num = JOptionPane.showInputDialog((Component) e.getSource(), "Enter Number of the Book:");
intConvNum = Integer.parseInt(num);
theList.insert(name,ConvNum,"Available");
            }
break;
case 3:{
            String num = JOptionPane.showInputDialog((Component) e.getSource(), "Enter Number of the Book:");
intConvNum = Integer.parseInt(num);
            Link d = theList.delete(ConvNum);        // delete item
if( d != null )
JOptionPane.showMessageDialog((Component) e.getSource(), "Deleted the book with number " + d.BookID);
else
JOptionPane.showMessageDialog((Component) e.getSource(),"Book is not in the list to delete");
theList.displayList(); 
             } 
break;
case 4:{
theList.displayList();
              String num = JOptionPane.showInputDialog((Component) e.getSource(), "Enter Book Nember:>");
intConvNum = Integer.parseInt(num);
              Link v = theList.seAv(ConvNum);
theList.displayStateall(v);
             }
break;
case 5:{ 
theList.displayList();
              String num = JOptionPane.showInputDialog((Component) e.getSource(), "Enter Book Nember:>");
intConvNum = Integer.parseInt(num);
              Link v = theList.seNAv(ConvNum);
theList.displayStateall(v);
              }
   }//end switch

     Option1 = JOptionPane.showInputDialog("\n1-Show List of bookes\n2-Add new book\n3-Remove book from list\n4-Borrow\n5-Return\n6-Exit");
     ConvOption1 = Integer.parseInt(Option1);

    }//end while
      }//end method public void actionListener
    });//end button2
//-----------------------------------------------------------------------------------------Button3        
JButton button3 = new JButton("Sub Users Access: Students & Teachers");   
button3.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e)
      {
           String Option2 = JOptionPane.showInputDialog(null, "\n1-Show list of bookes\n2-Search book\n3-Exit\n\nEnter a number of service", "Sub-Users Options", JOptionPane.INFORMATION_MESSAGE);
int ConvOption2 = Integer.parseInt(Option2);
while(ConvOption2!=3)
      {
switch (ConvOption2)
       {
case 1:{
theList.displayList();
            }
break;
case 2:{
              String key = JOptionPane.showInputDialog((Component) e.getSource(), "Enter Book Number:");
intConvkey = Integer.parseInt(key);
              Link f = theList.find(Convkey);          // find item
if( f != null)
                {         
theList.displayState(f);
                }
else
JOptionPane.showMessageDialog((Component) e.getSource(), "Can't find The book of number" + Convkey);
              }
break;
        }//end switch
      Option2 = JOptionPane.showInputDialog(null, "\n1-Show list of bookes\n2-Search book\n3-Exit\n\nEnter a number of service", "Sub-Users Options", JOptionPane.INFORMATION_MESSAGE);
      ConvOption2 = Integer.parseInt(Option2);
     }//end while
    }//end method public void actionListener
});//end button3 

//------------------------------------------------------------------------------------------Button4
JButton button4 = new JButton("Exit");
button4.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e)
      {
int result = JOptionPane.showConfirmDialog((Component) e.getSource(),"Close EQLS ");
if (result == JOptionPane.YES_OPTION)
        {System.exit(0);} 
      }
    });//end button3
//------------------------------------------------------------------------------------------
setLayout(new FlowLayout(FlowLayout.CENTER));
setLayout(new GridLayout(4,2));
getContentPane().add(button1);
getContentPane().add(button2);
getContentPane().add(button3);
getContentPane().add(button4);
  }//end public method Main
////////////////////////////////////////////////////////////////////////////////////
}//end class Main

and I did it on c++
but the requirement in c not in c++
could someone help me and make it in c or explain how I can make the change
thanks for you

sorry , for the spelling mistake (hay) I was meant (hi)
English isn't my mother language

The problem is in c, unlike java, has no support for a GUI
You could make your program work as c has a support for structures and linked lists but you'd have no choice but to remove the use of windows and buttons if your gonna convert it to c

Member Avatar for v3ga

You can make GUI in C. Here is tutorial for windows Forger's tutorial

Well I didn't mention Forger's since i think it's exclusive for windows
(maybe GTK+)
but my main point is it would be better if you can make the the basic purposes of the program work on a compiler before trying to make it run on a window

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.