Hey guys, Im new here so I hope this post is in the right spot. Im trying to get my code to callout to the other functions. When I debug the code, it only executes the Int Main section of my code. Can someone help me out and explain how to get the program to run fully. not just the last section.

-----------------------------------------------

#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int count_digits()
{
int numerator, denominator, max_digit;
printf("Enter how many digits are in numerator: ");

scanf("%d", &numerator);

printf("Enter how may digits are in denominator: ");

scanf("%d", &denominator);

printf("Enter the larger number of the two: ");

scanf("%d", max_digit);

return EXIT_SUCCESS;
}

int print_line()
{
int numerator;
int max_digit;

printf("Enter in max_digit value\n");
do
{
printf("%lf - %i\n",max_digit);
}while (max_digit==numerator);

return EXIT_SUCCESS;
}

int main()
{
int numerator, denominator;

printf("Please input two integers for the variables:\n");

scanf("%d %d", &numerator, &denominator);

void print_fraction (int numerator, int denominator);

printf("The resulting two dimensional form is: %d");

return EXIT_SUCCESS;
}

Edited 6 Years Ago by Nick Evan: added code tags

Perhaps you should call your functions from main?
BTW: This looks like C, are you sure you want this in the C++-forum?

Sorry guys this is C code..Im not sure why I posted it in the C++ forum. But im pretty sure the solution is similar in either language.

I read the tutorial, but im having trouble applying it to this code. The tutorial seems to focus only on automated functions, not when user input is needed.

I read the tutorial, but im having trouble applying it to this code. The tutorial seems to focus only on automated functions, not when user input is needed.

When calling the function, it's contents are irrelevant. Whether the function interacts with the user or not really doesn't matter. A call is a call is a call. The important parts are being sure your call matches the function's definition and that the definition matches the prototype.

In your posted code, you are attempting to use a prototype as a call, which is not allowed. Also, I just noticed that you are attempting to call a function that you don't seem to have prototyped/declared or defined anywhere in your code. I suggest you double-check the name of the function you are trying to call. A function call should have no data types in it (unless you are using a type cast, but let's not get into that).

void someFunction (int aParameter);  // a function prototype

// a function definition
void someFunction (int aParameter) {
  cout << "The parameter value is: " << aParameter << endl;
}

// a variable declaration
int anArgument = 5;

// a function call
someFunction(anArgument);

Edited 6 Years Ago by Fbody: n/a

This article has been dead for over six months. Start a new discussion instead.