Hi sorry for asking to many questions but I have compiled the code for division and multiplication, which all ask 10 random questions on both section and the user has to enter them. I'm receiving this error on line 39 and 68 ' too few arguments to function 'generateQuestions' . I would be tremendously grateful if anyone can help me on this.
Thank you. -
-
-
#include <stdio.h>
-
#include <stdlib.h>
-
-
int a;
-
int b;
-
int choice;
-
-
#define SIZE 10
-
-
//FUNCTION PROTOTYPE
-
-
void generateQuestions(int a[], int b[], int c[], int d[]);
-
void multiplication(int a[], int b[], int c[]);
-
int printResult_multiplication(int a[], int b[], int ca[],int ua[]);
-
void division(int a[], int b[], int d[]);
-
int printResult_division(int a[], int b[], int ca[],int ua[]);
-
-
//PROGRAM BODY
-
-
int main(void)
-
{
-
-
printf("This program tests you with ten questions.\n 1) Multiplication\n 2) Division\n 3) Exit\n Please make a selection (1-3)\n");
-
scanf("%d", &choice);
-
if(choice==1)
-
{
-
int i;
-
int ans;
-
int x[SIZE];
-
int y[SIZE];
-
int answer[SIZE];
-
int useranswer[SIZE];
-
int score=0;
-
-
srand(time(NULL));
-
-
generateQuestions(x, y, answer);
-
multiplication(x, y, useranswer);
-
score= printResult_multiplication(x, y, answer,useranswer);
-
-
if (score > 7)
-
{
-
printf("Congratulations! You scored %d/%d\n",score,SIZE);
-
-
}
-
else if (score <= 7)
-
-
{
-
printf("Please ask your teacher for help! You scored %d/%d\n",score,SIZE);
-
-
}
-
}
-
else
-
if (choice==2)
-
{
-
int i;
-
int ans;
-
int x[SIZE];
-
int y[SIZE];
-
int answer[SIZE];
-
int useranswer[SIZE];
-
int score=0;
-
-
srand(time(NULL));
-
-
generateQuestions(x, y, answer);
-
division(x, y, useranswer);
-
score= printResult_division(x, y, answer,useranswer);
-
-
if (score > 7)
-
{
-
printf("Congratulations! You scored %d/%d\n",score,SIZE);
-
-
}
-
else if (score <= 7)
-
-
{
-
printf("Please ask your teacher for help! You scored %d/%d\n",score,SIZE);
-
-
}
-
}
-
-
return 0;
-
}
-
-
//FUNCTION DEFINED
-
-
-
//GENERATE QUESTION FUNCTION
-
void generateQuestions(int a[], int b[], int c[], int d[])
-
{
-
int i;
-
for(i=0; i<SIZE; i++)
-
{
-
a[i]=rand()%11;
-
b[i]=rand()%11;
-
c[i]=a[i]*b[i];
-
d[i]=a[i]%b[i];
-
-
}
-
-
}
-
-
//MULTIPLICATION FUNCTION
-
void multiplication(int a[], int b[], int c[])
-
{
-
int i;
-
int ans;
-
printf("Please give the answers to the following additions:.\n");
-
-
for(i=0; i<SIZE; i++)
-
{
-
-
printf("%d x %d = ",a[i],b[i]);
-
scanf("%d",&ans);
-
c[i]=ans;
-
}
-
}
-
-
-
//DIVISION FUNCTION
-
void division(int a[], int b[], int d[])
-
{
-
int i;
-
int ans;
-
printf("Please give the answers to the following additions:.\n");
-
-
for(i=0; i<SIZE; i++)
-
{
-
-
printf("%d / %d = ",a[i],b[i]);
-
scanf("%d",&ans);
-
d[i]=ans;
-
}
-
}
-
-
-
//PRINT DIVISION SUMMARY FUNCTION
-
int printResult_division(int a[], int b[], int ca[],int ua[])
-
{
-
int i;
-
int score=0;
-
for(i=0; i<SIZE; i++)
-
{
-
printf(" %d / %d = %d -", a[i],b[i],ua[i]);
-
if(ua[i]==ca[i])
-
{
-
score=score+1;
-
printf("Correct answer\n");
-
}
-
else
-
{
-
printf(" Incorrect answer - the answer is %d \n",ca[i]);
-
}
-
}
-
-
return score;
-
}
-
-
-
//PRINT MULTIPLICATION FUNCTION
-
int printResult_multiplication(int a[], int b[], int ca[],int ua[])
-
{
-
int i;
-
int score=0;
-
for(i=0; i<SIZE; i++)
-
{
-
printf(" %d * %d = %d -", a[i],b[i],ua[i]);
-
if(ua[i]==ca[i])
-
{
-
score=score+1;
-
printf("Correct answer\n");
-
}
-
else
-
{
-
printf(" Incorrect answer - the answer is %d \n",ca[i]);
-
}
-
}
-
-
return score;
-
}
-
-
-
2 3159
You're only passing in 3 parameters into the function while your function is expecting 4.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Lian Liming |
last post by:
Hi, all
I want to write my own error handler function in php by using
"set_error_handler()" function. I have made a test for this function but
found it did not work. My test code is as following:...
|
by: murphy |
last post by:
Hi,
I've been seeing two symptoms with my asp.net site that have started
recently after a long period of smooth running. As others on our team
make changes to referenced dll's I find that I...
|
by: Alexander Cohen |
last post by:
(sorry for the double post if there is one - i sent the mail to the
lisyt from the wrong address)
Hi,
Im passing this in the commmand line to start up the PostgreSQL server:
../pg_ctl start...
|
by: Jozef |
last post by:
I have an MDE file that is blowing up with "Error 3075 Function Not
Available", which is normally a reference issue, but, I have no missing
references.
It seems that offending function is a...
|
by: joe10001 |
last post by:
Hi all,
I just installed CRELoaded (oscommerce fork) on my server and all work
fine except that I have a little message at the bottom of the main page
:
Fatal error: main() : Security alert:...
|
by: Hexer |
last post by:
Hi and good day to all...I am new to the C language and whenever I tried to run the program I made, it won't because it says it has an "expression syntax error in function main"..what I don't get is...
|
by: sadique |
last post by:
Hello,
Sadique here
I've been installing a free source hotel booking system and I encountered an error while trying to go to the second step in the installation process.
Fatal error:...
|
by: Sonasang |
last post by:
Hi ,
I am creating a web page with ASP and Javascript.We have shared the foldres containg the code and all our team members are accessing the code.
There is no problem for me when i run the...
|
by: pnbaocuong |
last post by:
Dear All
When I try to use convert function of MS sql server like this:
String sql = " (employee_id = '" + employee_id + "') and ((convert(VARCHAR,w_date,103) = '" + w_date + "'))";
...
|
by: kinhoe |
last post by:
i have a program in webserver. i run smooth before. but dunno why it sudden prompt out the error below?
Warning: require_once() : open_basedir restriction in effect....
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |