int main() { printNumbers(1, 10); // 인수 개수 1개 printNumbers(2, 10, 20); // 인수 개수 2개 printNumbers(3, 10, 20, 30); // 인수 개수 3개 printNumbers(4, 10, 20, 30, 40); // 인수 개수 4개 return 0; }
int main() { uint8_t display[8] = {1,1,1,1,1,1,1,1}; printf("Befroe func: "); printNumbers(display, 8); printf("\n"); maxDisplayFigure(3, display, 1, 2); printf("\n"); printf("after function : "); printNumbers(display, 8); printf("\n"); return 1; }
int main(){ int ch; int error = 0; int currentNum=0; ch = getchar(); while ((ch != EOF) && (error == 0)){ if (isdigit(ch)){ currentNum = (currentNum* 10) + (ch - '0'); } else if (currentNum > 0){ error = addNumber(currentNum); currentNum = 0; } ch = getchar(); } if (error == 0){ printNumbers(); printf("The sum is: %d", total); }else { printf("Too many numbers."); } }
int main(int argc , char *argv[]) { int no_of_elements = 0; int loop; unsigned int temp_num; Error error = FALSE ; if(argc!=2){ fprintf(stderr,"usage:program no_of_elements \n"); return 1; } no_of_elements = atoi(argv[1]); //print the number in sorted order for(loop = 0; loop < no_of_elements ; loop++){ printf("enter the number \n"); scanf("%d",&temp_num); if(setBit(temp_num)){ printf("error in setting the bit for integer\n"); error = TRUE; break; } } if(error){ printf("program does not completed successfully\n"); return 1; }else{ //print the number in sorted order printf("printing the numbers in sorted manner \n"); printNumbers(); printf("program completed successfully \n") ; return 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; }
void readLinesFromFile(const char* filePath) { assert(filePath); std::string lineBuffer; std::ifstream file; file.open(filePath); while (std::getline(file, lineBuffer)) { if (lineBuffer.empty()) { continue; } std::vector<std::string> numbers = tokenizeString(lineBuffer, ";"); printNumbers(numbers); } }
int main(int argc, const char * argv[]) { // Collect User Inputs for Fuzz, Bizz, Nezz inputFuzz(); inputBizz(); inputNezz(); printf("\nHere are the user inputs:\nFuzz = %d\nBizz = %d\nNezz = %d\n\nBelow are the FuzzBizzNezz Numbers\n\n",fuzz, bizz,nezz); // Print numbers and execute logic printNumbers(); return 0; }
int main() { printNumbers(); return 0; }
int maxDisplayFigure(uint32_t figure, uint8_t *display, uint8_t start_digit, uint8_t len) { // Mod to: figure, current_figure, startpoint, len printf("Figure: %i ", figure); printf("Display: "); printNumbers(display, 8); uint8_t i; uint32_t limit; // sanity checks and trimming if (start_digit + len > 9) { return 1; } start_digit -= 1; limit = 1; for (i = 0; i < len; i++) { limit *= 10; } printf("Limit: %i ", limit); figure = figure % limit; printf("Figure: %i \n", figure); // Insert the figure to the display var and update display for (i = start_digit + len; i > start_digit; i--) { printf("start_digit: %i len: %i i: %i figure: %i\n", start_digit, len, i, figure); if (!figure) { if (leading_zero_suppression) { display[i - 1] = 10; // 10 is blank index } else { display[i - 1] = figure; } } else { display[i - 1] = figure % 10; figure /= 10; } // TODO: Leading zero supression } printf("Figure: %i ", figure); printf("Display: "); printNumbers(display, 8); return 0; }