Help me to porting small code C > Blitzmax

Übersicht BlitzMax, BlitzMax NG Beginners-Corner

Neue Antwort erstellen

 

SsolidThinkK

Betreff: Help me to porting small code C > Blitzmax

BeitragMo, Nov 23, 2009 16:10
Antworten mit Zitat
Benutzer-Profile anzeigen
Hello,

Sorry for write in bad english, Rolling Eyes

i want porting this C code in Blitzmax code, help me...please

Code: [AUSKLAPPEN]


double ts[SIZE], A[SIZE], B[SIZE], P[SIZE];
main()
{
   int i, k, p, N, L;
   double avg, y, sum, psmax;

   /* read in and scale data points */
   i = 0;
   while(scanf("%lf", &y) != EOF) {
      ts[i] = y/1000.0;
      i += 1;
   }
   /* get rid of last point and make sure #
      of data points is even */
   if((i%2) == 0)
      i -= 2;
   else
      i -= 1;
   L = i; N = L/2;





thank you

ComNik

BeitragMo, Nov 23, 2009 21:44
Antworten mit Zitat
Benutzer-Profile anzeigen
BlitzMax: [AUSKLAPPEN]

SuperStrict

Global ts:Double[SIZE], A[SIZE], B[SIZE], P[SIZE]

Function Main() 'Not required, just to point out were it would be in c Wink
Local i:Int, k:Int, p:Int, N:Int, L:Int
Local avg:Double, y:Double, sum:Double, psmax:Double

'Read in and scale data points
While Not Eof(stream) 'You have to create a new Stream first, but you can figure out how to do that by youreself Wink

ts[i] = y/1000.0
i:+ 1

Wend

'Get rid of last point ...
If i Mod 2 = 0
i:- 2
Else
i:- 1
L = i
N = L/2 ' (Or L Shr 1...)
EndIf


But i looks like the code is not complete. I highly recommend reading that: http://www.2dgamecreators.com/blitzmax/resources/

So far...
WIP: Vorx.Engine
 

Dreamora

BeitragDi, Nov 24, 2009 4:54
Antworten mit Zitat
Benutzer-Profile anzeigen
Please post english questions on the regular Blitz boards (http://www.blitzbasic.com).

Postings made here are expected to be in german (not bablefish / google translator german but native german)
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen.
 

SsolidThinkK

BeitragDi, Nov 24, 2009 13:29
Antworten mit Zitat
Benutzer-Profile anzeigen
ComNik hat Folgendes geschrieben:
BlitzMax: [AUSKLAPPEN]

SuperStrict

Global ts:Double[SIZE], A[SIZE], B[SIZE], P[SIZE]

Function Main() 'Not required, just to point out were it would be in c Wink
Local i:Int, k:Int, p:Int, N:Int, L:Int
Local avg:Double, y:Double, sum:Double, psmax:Double

'Read in and scale data points
While Not Eof(stream) 'You have to create a new Stream first, but you can figure out how to do that by youreself Wink

ts[i] = y/1000.0
i:+ 1

Wend

'Get rid of last point ...
If i Mod 2 = 0
i:- 2
Else
i:- 1
L = i
N = L/2 ' (Or L Shr 1...)
EndIf


But i looks like the code is not complete. I highly recommend reading that: http://www.2dgamecreators.com/blitzmax/resources/

So far...


thank you for your kind reply.

Neue Antwort erstellen


Übersicht BlitzMax, BlitzMax NG Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group