Example #1
0
int main(int argc, char * argv[])
{
	double numbers[SIZE];
	readNumbers(numbers, SIZE);
	printNumbers(numbers, SIZE);
	cout << "Sum: " << sum(numbers, SIZE) << endl;
	cout << "Average: " << average(numbers, SIZE) << endl;
	cout << "Max: " << max(numbers, SIZE) << endl;
	cout << "Min: " << min(numbers, SIZE) << endl;
	cout << "Range: " << range(numbers, SIZE) << endl;
}
Example #2
0
void InputLine::readInput(){
	if(inputActive){
		lcdSetCursor(cursorPoint, row);
		cursorBlinker(); 
	  
		char key = keyPadReadKey();
	  
		switch(currentReadMode){
			case 0: readNumbers(key); break;
			case 1: readLetters(key); break;
			default: break;
		}
	}
}
Example #3
0
int main(int argc, const char * argv[])
{

    int n ; // the number of positive integers you input,
            // it will be brought back by using call-by-reference next line.
    int * arr = readNumbers( & n );
    
    if( arr != NULL && n > 0 ) {
    
        int median = computeMedian(arr, n);
        printf("The median for the group of numbers you input is: %d \n", median );
    }
    else{
        
        printf("No positive number has been input! \n");
    }
    
    free(arr); //deallocate what arr points to.
    
    return 0;
}
int main(int argc, char* argv[])
{
	FILE *inFile;
	char *fileName;
	complejo *complejos;

	if(argc != 2){
			printf("error arguments\n");
			printf("./a.out <nombre archivo> \n");
			exit(1);
		}

	fileName = argv[1];
    inFile = fopen(fileName, "r");

	if(inFile == NULL){
        printf("No se puede abrir el fichero: %s\n", fileName);
        exit(EXIT_FAILURE);
    }

	/*Invo functions*/
	numComplejos = getNumComplejos(inFile);
    complejos = (complejo *)malloc(sizeof(complejo) * numComplejos);
	readNumbers(complejos, inFile);
	showNumbers(complejos, inFile);	
	suma(complejos);
	resta(complejos);
	multiplicacion(complejos);



	/*Close*/
	fclose(inFile);


return 0;
}