C :: Math Quiz Program - Multiplication Function

Nov 16, 2014

Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void correctResponse(void);
void incorrectResponse (void);
void multiplication( void ); // function prototype

[Code] ....

// end function multiplication

// It keeps crashing. How do I compile the responses into a grade?

View 5 Replies


ADVERTISEMENT

C/C++ :: CodeBlocks Random Math Quiz Generator

Nov 26, 2014

The user will be allowed to pick:

-the number of problems they want to do
-the type of problem (addition, subtraction, multiplication, division)
-the range of numbers for the problems (like 0 to 9, -100 to 100, etc.) [random numbers in the range]

Your program will then display the given number of problems and get the answer from the user. It will tell the user it they are correct or not. If they are incorrect, it will print the correct answer.

After the given number of problems are displayed, the program will give the user the final number correct and percentage correct. The user will be asked if they want to go again. If so, you will reprompt the user for all the information and run again.

I came up with code thinking I was going in the right direction but it doesn't work correctly at all. We have to use functions. My main issue is how do i call variables from another function so all of the functions work together. I repeat I don't understand parameters and calling functions. here's the code:

#include <iostream>
#include <cstdlib>
#include <iomanip>
using namespace std;
int get_user_range(int &x, int &y);
int get_random_number ();

[Code]......

View 1 Replies View Related

C/C++ :: Quiz Program Based On Data File Handling

Dec 22, 2014

I'm trying to make a Quiz program based on C++'s Data File Handling capablities. I've attached the code in .txt file and I wonder why I'm getting the error identifier bScience cannot have a type qualifier?

Attached Files QuizPro.txt (9.6 KB)

View 7 Replies View Related

C++ :: Quiz Program - Checking Whether Entered Answer Is Correct From A File

Apr 15, 2014

My code is not moving past the line below...actually i am making a quiz and this piece of code id checking whether the entered answer is correct, from a file..

getline(anss,saveans);
while(a<1) {
getline(anss,saveans);
if (saveans == ToString(randNum)) {
getline(anss,saveans);
if (saveans == ans)

[Code] ....

View 9 Replies View Related

C :: Program That Grades A True / False Quiz - Data Available In Text File

Oct 14, 2014

You are to write a C program that grades a true-false quiz. The quiz data will be available in a text file; here is an example:

Quiz #8 (09/22/14) (corrected version)
TTFTTFTFTF
0080 TTFTTFTFTF
0340 TTFTFFTFTF

The first line in the data file is a comment that you may assume can be up to 80 charac- ters long; it cannot be blank. The second line contains the answer key for the 10-question true-false quiz. The following lines in the data file contain a student's id number in column 1 followed by their answers for the quiz in column 2. A 0 (zero) on a line by itself indicates that there are no more students to process.

Write a program that first reads in (from standard input; more on this in a moment) the comment line and answer key as strings followed by each student's data. Store the student's id numbers in an array. You are to "grade" each student's quiz using the key provided fol- lowed by recording their scores (in a second array) in order to be able to print them out later. You do not need to use an array of strings or characters in your program. Write your program allowing for up to 100 students, and you may assume that at least 1 student will have taken the quiz.

You should create test data text files and provide the data to your program using redirection from the command line (see the sample run below). Your program should output the number of students who took the quiz, the average score, the best score, and a table showing each student's id, score, and grade. The formatting, spacing, and labels in your output should 1 match the sample run below exactly.

Your program should determine each student's grade as follows: if the score is equal to the best score b or b−1, give an A. If it is b−2, award a B. Give C's for any score that is equal to b−3 or b−4, a D for b−5 and an F for all others.

Alright So I'm just stuck at comparing the key answer with student answer here is my code comparing one student's answer with the answer key . is that right ?? One more thing for some reason when i try to print answer[0] the result is nothing why is that

Code:
#include<stdio.h>
int main(void) {
char comment[80];
char answer [10];
char studentans [10];
int n=0,i=0,x=0;
int ID[10];

[Code] .....

View 1 Replies View Related

C/C++ :: Finding The Value Of Sin(x) Without Using Math Function

Apr 14, 2013

How can i solve a problem of sin(x) without using any math.h and only using my own declared function.

#include <stdio.h>
int fact (int a) {
    int i;
    int k = 1;
    for (i=1;i<=a;i++)

[Code] ....

View 3 Replies View Related

C :: Program That Solves Math Equations

Apr 30, 2013

I wrote a program that solves an equation of two numbers, but in addition to that, I want it to be able to continue to solve longer equations. Ex: ( solves 2 * 4, or 2 * 4 - 5).I want to put this part of the program's result into a variable and go from there. How do I place the result of the calculation into a variable, and where would it go?

Code:

#include <stdio.h>
#include <string.h>
int main(void) {
int a;
scanf("%d", &a);
char s[2];
scanf("%s", s);
int b;
scanf("%d", &b);
}

[code]....

View 4 Replies View Related

C++ :: Multiple Quiz Program - Adding High Score For Each User Stored In Binary File

Jul 11, 2014

I am making a multiple quiz program. So everything is working fine, except for the part where i'm trying to add a highscore for each user which is being stored in a binary file. I have added a sample of the program containing the error. This isn't the actual program, which is very long.

class user { //The collection of all info pertaining to the users
char user_id[50];
public:
int hscore1;
user() {
strcpy(user_id,"NULL");
hscore=0;

[Code] ....

View 1 Replies View Related

C# :: Can't Get Math (Sine) Function To Work

May 21, 2014

I'm having trouble with getting a sine function to work. All variables are defined earlier in the same section. I have the code in a button (where I figured it would go) but I get the following error:

WindowsFormsApplication2.Math does not contain a definition for 'Sin'

For reference, I am using Microsoft Visual Studio Express 2013, and am coding a Windows Forms Application.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;

[Code] ....

I've tried other functions as well (abs, sqrt, etc.) to no avail, as Math only seems to pop up with two options: Equals and ReferenceEquals.

View 2 Replies View Related

C :: Math Function Using Exponential Growth Formula

Sep 3, 2013

Its a basic math function using the exponential growth formula which is correct but the computer is not outputting the right numbers.

Code:
#include <stdio.h>
#include <math.h>
int main() {
int blanketsquares, num1, num2, blanket,remainder;

[Code] .....

View 6 Replies View Related

C++ :: Math Game Program - Stuck On Input File

Oct 21, 2013

I am making a math game program that simple and need to have a user input a name and then that name.txt is brought up and use variables from the text to add to their score. heres my code kinda long.

#include <iostream>
#include <cmath>
#include <cctype>
#include <string>
#include <ctime>
#include <cstdlib>

[Code] ....

View 10 Replies View Related

C :: Multiplication With Sort Function

Oct 30, 2014

I need to include validation to only accept numbers and to only the last four odd numbers in the table.

Code:

#include <stdio.h>void main() {
int upper, range, i;
printf("Enter an integer to find multiplication table: ");
scanf("%d",&upper);

[Code].....

View 3 Replies View Related

C++ :: Program To Display Multiplication Tables

Feb 8, 2014

I have to write a program to display multiplication tables. I have written the following code:

Code:
#include <iostream>
#include <cstdio>
using namespace std;
int main(){

[Code] ....

View 2 Replies View Related

C :: Program On Multiplication Of Matrices Using Functions

Feb 26, 2013

when i am running this program no errors are being shown but as soon as i press ctr+f9 to run the program my tc++ window closes.....

Code:
#include<stdio.h>
#include<conio.h>
void multiply(int m1[50][50],int ,int,int m2[50][50],int ,int );
void main() {
int i,j,m,n,p,q,m1[50][50],m2[50][50];

[Code] ....

View 4 Replies View Related

C++ :: Forming A Matrix Multiplication Program

Oct 9, 2013

I just started Linear Algebra for my programming degree and to full understand everything I want to put it into code and make my own "matrix calculator." I have all the theory but I am having issues keeping the matrix variable and moving it around the class' functions to create it and output it. Once I know I have it saved I think I can get the addition/multiplication to work. Here is the code I have so far:

#include <string>
#include <iostream>
using namespace std;
class matrix {

[Code] ....

View 5 Replies View Related

C++ :: Getting Error In Karatsuba Multiplication Program

Oct 5, 2014

I have made a Biginteger class that performs multiplication operation according to Karatsuba's algorithm. But it seems that the code is not working perfectly.In the class I have made a function named karatsuba(BigInteger a1, BigInteger b1)that performs the Multilplication operation. There might be problems in this function as I have tried to store the original digits(neglecting the leading zeros) of the two big integer values into two integers or there might be problems in somewhere else. corrected version of this function? My code is given below:

#include <stdio.h>
#include <iostream>
#include <cstdio>

[Code].....

View 2 Replies View Related

C/C++ :: Getting Error In Karatsuba Multiplication Program?

Oct 5, 2014

I have made a Biginteger class that performs multiplication operation according to Karatsuba's algorithm. But it seems that the code is not working perfectly.In the class I have made a function named karatsuba(BigInteger a1, BigInteger b1)that performs the Multilplication operation. There might be problems in this function as I have tried to store the original digits(neglecting the leading zeros) of the two big integer values into two integers or there might be problems in somewhere else.My code is given below:

#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
using namespace std;
#define MAX_DIGIT 100

[code]....

View 5 Replies View Related

C++ :: Multiplication Table In A Void Function?

Jan 20, 2015

I wanted to make a multiplication table.

Here's the code:

#include<iostream>
#include<conio.h>
using namespace std;
void initArray(int arg1[50][50], int r, int c) {
int val=1;
for(int row=0; row<r; row++) {

[code]....

I want the output to be like this:

1 2 3
2 4 6
3 6 9

If the user inputs 3 rows and 3 columns.

View 5 Replies View Related

C++ :: Program Matrix Multiplication But It Work Not For Big Arrays?

Mar 9, 2014

I have a program matrix multiplication but it work not for big arrays. n should be bis 200.

#include <iostream>
#include <time.h>
#include <cstdlib>

[Code]....

View 6 Replies View Related

C# :: Writing A Program To Display Multiplication Table?

Feb 3, 2015

i need the output to display the product of every whole number from 1-3 in a table format.

this is the code i have so far. i know some brackets are missing but i just pasted the meat of the code. when i run the program i keep getting the number 1 displayed in a straight line going on forever

int multiply1 = 1;
int multiply2 = 1;
while(num1<=3)
{ // num1*num2;
//num1 = 0;
while(num2<=3)
{ Console.WriteLine(multiply1*multiply2);
if(num1>=3)
{ Console.Write();
}
}
num1++;
}

View 2 Replies View Related

C :: Program That Prints Multiplication Table Using Nested Loops

Mar 9, 2013

Write a program that prints a multiplication table using nested loops. In main ask the user for the smallest column number , the largest column number and the size of the increment. Ask the user for the same information for the row values.

In the example the column values entered are: 5, 15 and 2 and the row values 3, 6 and 1.

Given those numbers you would generate the following table.

Multiplication Table
| 5 7 9 11 13 15 ___|___________________________________ | 3 |
15 21 27 33 39 45 4 | 20 28 36 44 52 60 5 | 25 35 45 55 65 75 6 | 30 42 54 66 78 90
Print the 24 values with the grey background. The other numbers show the values to be multiplied.

Code:
#include<stdio.h>
main() {
int a,b,c,d,e,f;
int i,j,total;
printf("Please enter smallest column number: ");
scanf("%i",&a);
printf("

[Code] ....

Challenge:
As an added challenge try to print out the column
headings (5 7 9 11 13 15) and the row headings (3 4 5 6)

View 1 Replies View Related

C/C++ :: Parallelize Matrix Multiplication Function Dynamically And Statically

Oct 1, 2014

I've been trying to get my matrix multiplication program to run a few different ways. My assignments wants me to run it statically using chunks, but we're not supposed to use OpenMPs scheduler. So I'm not sure how that's possible. And secondly, we have to run it dynamically using locks/unlocks.

Static (not sure how to implement chunk)

#pragma omp section
{
printf("Thread %d doing matrix mult", threadID);
if (matrixAcols != matrixBrows) {
cout << "Error, operation not possible" << endl;

[Code]....

The code will run for a long time too. It uses as many threads as we tell it to but it never speeds up the results.

Quote
Thread 2 doing matrix mult
Thread 4 doing matrix mult
Thread 2 doing matrix mult
Thread 4 doing matrix mult
Thread 2 doing matrix mult
Thread 4 doing matrix mult
Thread 2 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult

View 2 Replies View Related

C/C++ :: Sequential Matrix Multiplication Program - Syntax Error Near Unexpected Token

Apr 30, 2014

I wrote a sequential matrix multiplication program in c.

After execution i get error like
./mul.c: line 11: syntax error near unexpected token `('
./mul.c: line 11: `int main(){'

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define wA (30 * 16)
#define wB (50 * 16)
#define hA (80 * 16)
#define hB wA
#define wC wB

[Code] ....

View 4 Replies View Related

C++ :: Function To Build Multiplication Table Of Arbitrary Dimensions - Unexpected Output

Nov 8, 2013

So the latest challenge from jumping into c++ is as following.

Code:
Write a function that builds the multiplication table of arbitrary dimensions This chapter also talks a ton about 2d arrays.

So I've built my program thus far as this.

Code:
#include <iostream>
using namespace std;
int drawTable(int,int);
int main()

[Code] .....

So basically, the idea is that I can use the arrays dimensions as a placeholder, and just multiple them to get that specific spot, so table[0][0] = 0, [0][1] = 0 and so on. However the output actually seems to be randomly generated numbers so I'd like to ask, what am I doing wrong? Am I on the right track? Or have I missed the bus stop completely.

View 12 Replies View Related

C# :: Drag And Drop Quiz

May 13, 2014

What I'm looking for is actually a few things. I want to creat a drag and drop like quiz. For example:

-You get 4 pictureboxes with 4 different pictures of pc components (the solutions). Below that there are 4 other empty pictureboxes to drag the picture to with text aside from them (the questions).Now How would I go about linking the different pictures to the correct text ? I already have drag and drop working, but the linking is killing me.

View 1 Replies View Related

C :: How To Add Timer To Mini Quiz Game

Jun 1, 2014

I want to add a timer to my mini quiz game and show how much time it took for the user to finish it .I want to learn how to do that in C language

NOTE: My program only has a splash screen Allegro

The files are attached :

A bitmap [URL] .....

(I couldn't attach because of the size is above 200 kb. Please save as a BMP file )
A text file
A CPP file

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved