By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,750 Members | 1,199 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,750 IT Pros & Developers. It's quick & easy.

need some conversion from turbo c++ to visual c++

P: 4
can you guyz pls tell me what would be the command of "linerel", "cos", "sin" of turbo c++ could be converted to visual c++ .??
Nov 7 '06 #1
Share this Question
Share on Google+
3 Replies


P: 2
As far as I understand ur problem u want ur program to run under VC++ environment. So I don't think there is any problem with that u can just copy that program of turboo C++ to VC++ editor. I am giving u a sample code

Example

/* SINCOS.C: This program displays the sine, hyperbolic
* sine, cosine, and hyperbolic cosine of pi / 2.
*/

#include <math.h>
#include <stdio.h>

void main( void )
{
double pi = 3.1415926535;
double x, y;

x = pi / 2;
y = sin( x );
printf( "sin( %f ) = %f\n", x, y );
y = sinh( x );
printf( "sinh( %f ) = %f\n",x, y );
y = cos( x );
printf( "cos( %f ) = %f\n", x, y );
y = cosh( x );
printf( "cosh( %f ) = %f\n",x, y );
}


Output

sin( 1.570796 ) = 1.000000
sinh( 1.570796 ) = 2.301299
cos( 1.570796 ) = 0.000000
cosh( 1.570796 ) = 2.509178
Nov 8 '06 #2

P: 4
Please help:

As long as I have completed the program to draw a koch snowflake curve in Visual C++ i am having an error : 'linerel' : undeclared identifier
Error executing cl.exe.
. can you tell me how can i run this program. Thats the only problem when i was trying to convert this program from turbo C++ to Visual C++ .

#include <stdlib.h>
#include<math.h>

class recursivecurve{
public:
recursivecurve(){angle=0.0;}
void readinitvalues();
void snowflake();
private:
double side, angle;
int level;
void right(double x){angle += x;}
void left(double x){angle -= x;}
void drawfourlines(double side, int level);
};

void recursivecurve::drawfourlines(double side, int level)
{
if (level== 0)
linerel ((cos(angle*3.14/180)*side),
(sin (angle*3.14/180)*side));
else{
drawfourlines(side/3.0, level-1);
left(60);
drawfourlines(side/3.0,level-1);
right(120);
drawfourlines(side/3.0,level-1);
left(60);
drawfourlines(side/3.0,level-1);
}
}

void
recursivecurve::snowflake()
{ int i;
for (i=1;i<=3; i++){
drawfourlines(side,level);
right(120);
}
}
Nov 11 '06 #3

Banfa
Expert Mod 5K+
P: 8,916
linerel is not a standard function and therefore you should not be surprised that it is not in Visual C++, it is clearly a Borland extension.

You will need to understand what this function does and then either find a replacement using Visual C++ extensions or write you own function that does the same thing.
Nov 11 '06 #4

Post your reply

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