my output cant display

#include <iostream.h>
#include <bits/stdc++.h>

using namespace std;
      
	  
	   struct Node
	   {
	       int data;
		   struct Node* next;
		   };
		   
		   
		   int small(struct Node* head)
		   {
		   
		   int min = INT_MAX;
		   
		   
		   while (head != NULL)
		   {
		   
		      if ( min > head->data)
			       min = head->data;
				   
				   head = head->next;
				   }
				   return min;
				   }
				   
				   
				   
				   void push (struct Node ** head ,int data)
				   {
				   	struct Node * newNode ;
					
					newNode->data=data;
					
					newNode->next = (*head);
					(*head) = newNode;
					}
					
				   
				   void display(struct Node* head)
				   {
				    while ( head != NULL ) 
					{
					   printf("%d -> ", head->data);
                          head = head->next;
					
					}
					cout << "NULL" << endl;
					}
				   
			int main()
			{
			   int x;
			  struct Node* head = NULL;
			  
			  
			   push(&head,5);
			   push(&head,10);
			   push(&head,19);
			   
			   cout << "Linked list is:"<<endl;
			   
			   display(head);
			   cout <<"The minimum element in linked list :"<<endl;
			   cout << small(head) <<endl;
			   
			   
			   return 0;
			   }

Open in new window

Ewe kean tanJunior C++Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sarabandeCommented:
#include <iostream.h>

Open in new window


this header file is deprecated since 19 years.

use

#include <iostream>  // no .h extension

Open in new window


to get the classes from C++ standard (STL) in namespace std.

Sara
0
Ewe kean tanJunior C++Author Commented:
i using old version quincy 2005 . This should include h.extension . the problem is output cant display
0
sarabandeCommented:
c++ standard is from 1998 and you were using statements like

using namespace std;

Open in new window


which only would compile if the compiler HAS a standard template libary (STL).

what happens if you were using the right include statement?

Sara
0
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

sarabandeCommented:
note, an 11 years old compiler doesn't give any advantage, even if you have old code which doesn't compile with newer compilers.

all the errors you get easily could be corrected granted that your coding has at least basic quality.

Sara
0
sarabandeCommented:
if your platform is windows you can get visual studio 2017 community for free.

Sara
1
RaminTechnical AdvisorCommented:
Try This:
#include <stdio.h>
0
sarabandeCommented:
don't think you should use stdio.h in c++

it is  a c header for console output. some of the functions like printf belong to the most dangerous code functions as they are vulnerable to be hacked by malware.

if you are on unix you should use gcc and eclipse.

i found the following regarding quincy 2005:

Because of it's simple interface, Quincy is ideal for learning C or C++ ... Quincy 2005 makes it easy to use the MinGW C/C++ compiler, and the GDB debugger.

the MINGW compiler has actual compilers which are compliant wit newer c++ standards (like c++11) . the quincy is only an IDE and the compiler could be updated with newer versions.

Sara
1
evilrixSenior Software Engineer (Avast)Commented:
Well, I've compiled your code (after fixing iostream.h, as suggested by Sara) and I get the following output...


Success      #stdin #stdout 0s 15240KB
Linked list is:
NULL
The minimum element in linked list :
2147483647

https://ideone.com/iOqk5b to view the code and output.

So, with that in mind, what - exactly - is your issue? What is the expected output?
2

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ewe kean tanJunior C++Author Commented:
my expected output was find the smallest element in linked list while get the user input  . btw u code is work well .
0
Ewe kean tanJunior C++Author Commented:
i will try sara suggest  visual studio 2017  ...Thank you sara
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.