Solved

conversion of pascal to c

Posted on 2004-03-20
7
475 Views
Last Modified: 2010-04-16
hi
In the program posted before

 http://www.experts-exchange.com/Programming/Programming_Languages/Pascal/Q_20920285.html

I have problems in converting the followiing to c.p2c was giving some stnage error.If anyone of u trythe code in p2c and tell me what is the problem that would be great.Anyway I started to convert it manualy and i just wanted to know the equivalent code in c.If u want to know more abt the procedures refer to the code in the above thread
1
 unit allint;
interface
uses crt,dos,printer,lpvars,stackm;
what is the equivalent header for this in c

2.
PROCEDURE CreateLpLabel(i:integer);
VAR kf,kr,l,m,n:integer;
when i convert the above procedure into a c function wat about the variables l,m,n......it shuld be passed as paramters or does it mean some other thing

3. procedure AllIntegerGomory;

implementation

and
LpLabels[i] = Copy(Spaces,1,kf) + Copy(SymTab[Variables[i]].lexeme,1,m)
                 + Copy(Spaces,1,kr);

how this should be converted to c????????

thanks
ganesh
0
Comment
Question by:reachganesh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 11

Accepted Solution

by:
Jase-Coder earned 250 total points
ID: 10645149
1:

#include <stdio.h>
#include <windows.h>

2:
void CreateLpLabel(int i)
{
   int Kf, Kr, L, M, N;

} the above variables only need to be passed as parameters if they are to be used in another part of the program.

3:
 void AllIntegerGomory(void);

4:
  use the functions: strcpy() and strcat()
0
 

Author Comment

by:reachganesh
ID: 10645420
Hi there
I was trying to use the p2c converter in this site  http://www.garret.ru/~knizhnik/pascal.html to convert the entire program but it did not work.Can you please have a look at this link(windows version) and tell me how can i use it to convert the code to c.Plz try to use the pascal code in this post
 http://www.experts-exchange.com/Programming/Programming_Languages/Pascal/Q_20920285.html  and lemme know what is the problem
thanks
ganesh
0
 

Author Comment

by:reachganesh
ID: 10646425
hi there
What is the difference between procedure and funciton in pascal Will there any difference in converting them to c .I see some of them starting with the begin kayword but some doesn't
PROCEDURE ALLintegerALG;

VAR  C, DENUM,I,J,K,L,NP,NUM,R,R1,S,T : INTEGER;
     kprt,lprt,jprt : integer;
     B, ITER : BOOLEAN;

-------------------------------------------------
FUNCTION EUCLID(U,V :INTEGER):INTEGER;
  VAR W : INTEGER;
  BEGIN
thanks
ganesh
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 100

Expert Comment

by:mlmcc
ID: 10664424
The difference between a procedure and function is a function returns a value and can be used in an expression.  A procedure stands alone.

Procedures translate to VOID functions in C.
The begin keyword provides when the code for the function starts.  AllintegerALG has a begin it is quite far below the header.

Pascal programs have a much different syntax from C program thus your problem in converting.

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10801151
This question has been classified abandoned. I will make a recommendation to the moderators on its resolution in a week or two. I appreciate any comments that would help me to make a recommendation.

Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help.jsp#hs5

mlmcc
0
 

Expert Comment

by:joseph789
ID: 10861444
Can i see some tutorials of Visual basic? The should include Objects, Windows programming, components and file handling
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 10865586
joseph789 - Please ask your own questions.  Also it would be better if this question were asked in the Visual Basic forum.

mlmcc
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime is disastrous for companies and can lead to major hits on a brand, reputation, an…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question