473,396 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Write this without lib and string.h files

plz urgent help thanks i need this without lib and string files
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<stdlib.h>
  4. #include<string.h>
  5. struct Node;
  6. typedef struct Node * PtrToNode;
  7. struct Node
  8. {
  9.     char element;
  10.     PtrToNode Next;
  11. };
  12.  
  13. PtrToNode MakeEmpty(PtrToNode L)
  14. {
  15.     L= new(Node);
  16.     L->Next=NULL;
  17.     return L;
  18. }
  19.  
  20. void Push(PtrToNode L,char x)
  21. {
  22.     PtrToNode S;
  23.     S= new(Node);
  24.     S->element=x;
  25.     S->Next=L->Next;
  26.     L->Next=S;
  27. }
  28.  
  29. char Pop(PtrToNode L)
  30. {
  31.     PtrToNode P;
  32.     P=L->Next;
  33.     char x=P->element;
  34.     L->Next=P->Next;
  35.     free(P);
  36.     return x;
  37. }
  38. int main()
  39. {
  40.     PtrToNode L;
  41.     L= MakeEmpty(NULL);
  42.     char Input[1000];
  43.     int i;
  44.     printf("please enter your equation:");
  45.     scanf("%s",Input);
  46.  
  47.     for (i = 0;i<strlen(Input);i++)
  48.     {
  49.     if (Input[i]=='(')
  50.     {
  51.         Push(L,Input[i]);
  52.     }
  53.     if (Input[i]==')')
  54.     {
  55.         if (L->Next==NULL)
  56.         {
  57.         printf("incorrect");
  58.         return 0;
  59.         }
  60.         else
  61.         Pop(L);
  62.     }
  63.  
  64.  
  65.  
  66.     }
  67.     if (L->Next==NULL)
  68.     printf("correct");
  69.     else
  70.     printf("incorrect");
  71.     getch();
  72.     return 0;
  73. }
Apr 16 '10 #1
2 1623
Banfa
9,065 Expert Mod 8TB
If you are not using any libraries how do you propose to get user input and to create output for the user to see?
Apr 16 '10 #2
donbock
2,426 Expert 2GB
Methodically go through your code to find the library functions that you're using. Then either replace the library function with a function of your own that does the same thing (for example, replace strlen with my_strlen) or change the design of the program to eliminate the need for the library function (for example, replace malloc/new with static variables).

As Banfa pointed out, you will find it pretty much impossible to write your own versions of the console I/O functions. Are you sure that is a requirement?
Apr 16 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: AVB | last post by:
Is there any other way to write files to a directory than allowing the IUSR write access. We have a website that will be writing XML files and Label files to a directory outside of our website...
1
by: Magix | last post by:
Hi, I have these string data: str_data1, str_data2, str_data3, which capture some value after a routine process A. Then I would like to write (append) these 3 string values into a text file each...
2
by: bob | last post by:
Hello, I want to show progress to the user while some method is running so I thought I'd use a progress bar. But I don't see how I can do this without writing GUI code in the model? In...
3
by: Mads Westen | last post by:
Hi, I'm making some changes to my program, because I need to write with Codepage 850. Before I used FileStream, but I found code to use with StreamWriter instead. My problem is, that I don't...
5
by: philip | last post by:
Here is some lines of code than I wrote. You can copy/paste theis code as code of form1 in a new project. My problem is this one : I try to write in a file a serie of bytes. BUT some bytes...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
0
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
8
blazedaces
by: blazedaces | last post by:
So I have a program below which writes an excel file with multiple sheets based on inputs of sheet names, data, cell types, etc. It uses Apache POI, which is currently the only thing I found...
3
by: maneshborase | last post by:
Hi friends, I am facing one serious problem in my application. I am trying to open dicom image file (.dcm) has size around 400 MB. But I am getting and unhandy exceptions, Some time, ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.