473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Function help

I'm creating this program to test the user on their
math skills on multiplication, addition, subtraction, and
division. The problem I'm having is refrencing functions
from other functions, here is a skeletal esample of my
code:

If you need more information PLEASE!!!! EMAIL ME!!
so that I could send you a .txt file of my code. Thanks
for your help.
-------int main()
\\ inside the main function there are variables
output to let the user know he has to enter
options for the difficulty level

Random_num() \\ I put the function there because
that is where the user will be
entering there choice.
\\ Then is asks for the user to pick what kind
of math problem they would like.

cin >> userchoice \\ that is the variable for
the "Choice" varible in the
Calculation function.

\\ while the counter is not 5 continue loop.

point += Calculation ( userchoice )
\\ after the while loop has been finished it
calculates the user's points and tells you
did bad or good.
------Random_num ( int )

cin >> choice \\ this is the varible for the
switch statement.

\\ I have a switch statment that gives the user
a choice of the intensity of the math problem
1 being easy, 2 being medium, and 3 being hard.
so, EASY SHOULD BE A = RAND() % 9
MEDIUM SHOULD BE A = RAND()% 99
HARD SHOULD BE A = RAND()% 999
the return would be difficulty

return DIFFICULTY;

-----Calculation ( int )

number one = Random_num () \\ THIS IS WHERE i'M HAVING
TROUBLE. I NEED
number two = Random_num () THE RETURN OF Random_num()
to be refrenced to number
one and number two.

\\ there is also a switch statment that gives the
user the option to pick which type of math
problem. 1 for additcion, 2 for subtraction
3 for multiplication, and 4 for division.
Also, in each case of the switch statement --
Choice, the user enters his/her answer.
\\ INSIDE EACH
EACH CASE, OF THE SWITCH, STATEMENT INCLUDES THE
VARIBLE THAT CALULATES THE ANSWER. SO,
case add : Right_answer = number one
+ number two;

\\ if the user gets the answer right the computer
increments a point for the user, so the
return is point.
return point;
Nov 16 '05 #1
0 858

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Edward King | last post by:
Hi! I am trying to achieve the following: I have a number of help pages (in the format help_nn.php where nn=helpid). I want to be able to open a particular help page by calling the function...
4
by: Joneseyboy | last post by:
Hi, I'm new to this so I could really do with some help! I am using VB.net to create a small game. basically there is a Textbox, a button and a listbox. The user enters a number into the...
2
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
1
by: intl04 | last post by:
I'm trying to set up a query that will include a new field ('Days until completion') whose value is derived from the DateDiff function. I think I have the syntax correct but am not sure. Days...
7
by: Mike D. | last post by:
I have a problem with a dynamic library I am developing, but it is really more of a pointer issue than anything else. Hopefully someone here can lend me some assistance or insight into resolving...
4
by: George Durzi | last post by:
I created a simple user control which contains a hyperlink to link the user to a topic in a compiled help file. I named all my help topics to have the same name as the aspx they are for. So in...
7
by: Jimakos Bilakis | last post by:
Hi guys! I'm using the C++ Builder 6 Enterprise Edition where I create some tables in Paradox and with the help of a structure i pass my data from the form (Edit boxes) to the Paradox table with...
10
by: David Fort | last post by:
Hi, I'm upgrading a VB6 app to VB.net and I'm having a problem with a call to a function provided in a DLL. The function takes the address of a structure which it will fill in with values. I...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
1
by: Beamor | last post by:
function art_menu_xml_parcer($content, $showSubMenus) { $doc = new DOMDocument(); $doc->loadXML($content);//this is the line in question $parent = $doc->documentElement; $elements =...
0
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...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.