Help in making a c program to a nds file
Posted: Sat Dec 06, 2008 5:47 pm
I'm kinda new here so please, i'd appreciate any help
I need help making my program run in my "Developer's System".
I've installed devkitpro and managed to "make" some examples and run them.
The problem is, i don't know how to make my own program run.
This is a code to determine which is the fastest program among the two other programs.
This code, is a C program works when i compile it with Dev C++, but it is restricted when i command make.
Too much errors it says and i don't know how to debug it .
i know it needs an #include<nds.h> , but thats all i know.
BTW, the running time of the program depends upon the value of *SIZE*.
I need to learn how to code on the DS so that i can leave it on overnight and save electricity.
This is for our subject - data structures.
I've been getting sleepless nights from this.
O, if i missed any details, kindly inform me. I'll reply by tomorrow. I've gotta get some sleep
I need help making my program run in my "Developer's System".
I've installed devkitpro and managed to "make" some examples and run them.
The problem is, i don't know how to make my own program run.
This is a code to determine which is the fastest program among the two other programs.
This code, is a C program works when i compile it with Dev C++, but it is restricted when i command make.
Too much errors it says and i don't know how to debug it .
Code: Select all
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <stdlib.h>
#define size 1000
int maximum (int x, int y)
{
if (x < y)
return y;
return x;
}
main(){
int X[size];
int MaxSoFar = 0, Sum = 0;
int L, I, U;
int i;
srand(time(NULL));
for(i = 1; i < size; i++)
X[i] = rand() % 201 - 100;
clock_t startTime = clock();
for(L = 0; L < size; L++)
for(U = L; U < size; U++)
{
Sum = 0;
for(I = L; I <= U; I++)
Sum = Sum + X[I];
MaxSoFar = maximum(MaxSoFar, Sum);
}
clock_t endTime = clock();
printf("\ntotTime (in ms): %d", size * (endTime - startTime) / CLOCKS_PER_SEC);
printf("\nSum : %d", MaxSoFar);
getch();
}
BTW, the running time of the program depends upon the value of *SIZE*.
I need to learn how to code on the DS so that i can leave it on overnight and save electricity.
This is for our subject - data structures.
I've been getting sleepless nights from this.
O, if i missed any details, kindly inform me. I'll reply by tomorrow. I've gotta get some sleep