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;
}

Recommended Answers

All 6 Replies

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

Your call appears to be formatted incorrectly, but I can't tell if that's the only issue.

I suggest you read this first.

As well as this.

[edit]
oops..... a mod (Nick Evan) beat me to it....

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.

No worries. In the edited version, Line 46 is a function prototype, it is NOT a function call. I suggest you read this tutorial.

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);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.