0

um, I'm using Turbo C++ IDE with the blue screen thingy.

but it won't run. i mean, whenever i try to run it to show output, it says
"Error
not an exe
FILENAME.LIB"

um, im kinda new at this, i just need it for school. how do i fix it?...:'(

please and thanks in advance.. :$

3
Contributors
2
Replies
6
Views
6 Years
Discussion Span
Last Post by elmonko
0

same prob here im running it under DosBox but still shows the same message buts only with the next piece of code :

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <dos.h>

int iprot(int argc,char *argv[],int pluck);
void miso(char s[],char *argv[]);
int es_primo(int n);

FILE * fp;
int i, n,pluck;

 int main(int argc , char *argv[])
 {
	int tao;
	char s[25];

	tao = iprot(argc,argv,pluck);
	if(tao == 1){

		miso(s,argv);
	}

	fclose(fp);

 return 0;
 }

void miso(char s[],char *argv[]){
	//int pluck;
	strcpy(s,argv[0]);
	clrscr();
	printf(" El contenido de <s> \t%s",s);
	delay(1500);
	//pluck = atoi(argv[1]);
	fp = fopen(s, "w");
	i = 1;
	n = 0;
	while (n<1000) {
		if (es_primo(i)) {
			fprintf (fp, "%d\n", i);
				n++;
		}
		i++;
	}
}


 int es_primo(int n)
 {
	int i, j, primo;
	 primo = 1;
	 for (j=2; j<=n/2; j++){
		 if (n % j == 0) {
			primo = 0;
			break;
		 }
	 }
	return primo;
 }

 int iprot(int argc,char *argv[],int pluck){

	if(argc<2){
		printf("\n No existen los parametros suficientes para iniciar el programa");
		delay(2000);
		return (3);
	}
	pluck = atoi(argv[1]);
	printf("\n el segundo parametro como integer es: \t%d ",pluck);
	printf("\nLos parametros son 1) %s y \t 2) %s",argv[0],argv[1]);
	delay(4000);
	return (1);
 }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.