simplify functions

Pages: 12
hey guys

i have this assignment which I have no clue how to do it

so i was wondering if u guys could help with it

the question is :
Write a C++ program which contains three functions:
First function prints multiple of 4 between two numbers x and y.
Second function returns number of odd numbers between x and y.
Third function swaps two elements x and y.

Note : The user should enter x and y in the main function .

I really hope u help me
Have you tried any of it?
If you have no code for it, have you considering stepping through how the process would work for these functions in pseudo code?
kbw
yes i have .. and i was able to do each one by itslef
but i cant figure how to put them all together

mythios ... wt do u mean by pseude ?
We can comment on what you've done, but if you don't post anything, we can't comment.
Indeed, just post us all the code from what you've made in code tags
[code]Code here[/code]
Last edited on
"Pseudo" means false. Pseudo-code is "fake" code. It's a way to write out a programming task using simple english so that you can better see the logic without the confusion of programming language syntax, rules, etc.

http://en.wikipedia.org/wiki/Pseudocode
ok here are three of the function i should use
the 1st one

void initialize (int& lc, int list[])
{
int j ;
lc=0;
for ( j = 0; j < 26; J++)
list[j] =0;
}
//end initialize

the 2nd one

void characterCount (char ch, int list[])
{
int index;
ch = toupper (ch);
index = static_cast<int> (ch) _ static_cast<int> ( 'A');
if ( 0<= index && index < 26)
list[index]++;
}
// end characterCount

the 3rd one

void copyText ( ifstream& intext, ofstream* outtext, char& ch, int list[])
{
while (ch != '\n' )
{
outtext << ch;
characterCpint ( ch, list);
intext.get (ch);
}
outtext << ch;
}
// end copyText


i hope u can help me now
Self wrote:
Indeed, just post us all the code from what you've made in code tags
[code]Code here[/code]

I'm confused, what does this have to do with your problem in your first post?
Last edited on
wow i'm really confused here you ask for help on some logical mathematics problem and you give us string manipulation code what are you trying to achieve?
i was asked to use these functions to create a programme
Have you attempted the first one: First function prints multiple of 4 between two numbers x and y.

Let's work with that. Can you post what code you have?
So your tutor wants you to use these functions you've posted to create the function you've asked for?
exactly ^^
Well then we are back to step one. How would you go about doing it. Start throwing out some ideas how you think it could be done.
You've got to be kidding me. String manipulation functions to create arithmetic functions. That... probably isn't right. Are you sure that you're not supposed to write your functions from scratch?

-Albatross
ok to be honest ... im not sure now

wt i know is .. i need to do wt the quesion says :D
So basically you have no clue? Why don't you write a small program, create the functions with no bodies and set everything up how you think you'd do it. That way we can tell you if you're on the right track and maybe do one of the functions for you to show you how it's done. But you can setup the structure for it first.
First function prints multiple of 4 between two numbers x and y.


is this a range thing as in x is 1 and y is 50 find the multiples of 4 in the range of 1 and 50?

or

x is 30 and y is 50 find what multiples of 4 they share?
ok how about u guys do me the first one .. just to see how it works
Pages: 12