d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Hw Help
Add Reply New Topic New Poll
Member
Posts: 14,537
Joined: Feb 13 2007
Gold: 3,241.00
Nov 3 2013 11:39am
If someone could explain this possibly give answers after explanation that would be cool too lol

Assignment 7 (due 11/1, noon, cutoff 11/3)

Write a complete C++ program that does the following:
1. The program will ask user to input 2 numbers greater than 1000. If the number
entered is not valid, it will continue asking user until valid number is entered.
2. The program will contain 3 functions.
a. Function isPrime to test whether a parameter is prime. Then the program
(main program) should utilize this is function and prints all the prime
number up to 100. Remember, prime numbers are numbers that are only
divisible by one and itself. (35pts)
b. Function reverse to reverse all the digit in its parameter and returns the
result. (25pts)
c. Function biggestDigit finds the biggest digit in the integer parameter.
(35pts)
NOTE: for part b and c, the parameter passed will be the original two
input numbers.

The output of the functions above should be similar as follows :

int main () {
int b1, b2;
cout << “Please enter 2 integers.”;
cin >> b1 >> b2 ; // b1 = 412, b2 = 29
cout << biggestDigit(b1) << endl; // prints 4
cout << biggestDigit(b2) << endl; // prints 9
cout << reverse(b1) << endl; // prints 214
cout << reverse (b2) << endl; // prints 92
return 0;
}
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 3 2013 12:02pm
what part don't you understand? it seems very straight forward.
Member
Posts: 14,537
Joined: Feb 13 2007
Gold: 3,241.00
Nov 3 2013 01:08pm
i havent had the time to learn it thats the problem ive been busy with other stuff and i just need it done i know ill need to learn it later tho

will pay fg if anyone can do this
Member
Posts: 23,261
Joined: Dec 17 2006
Gold: 18,129.00
Nov 3 2013 02:09pm
Looks like it's due today and you just now post it?

Pseudo code wise:

Quote

Ask for 2 integer inputs
Store inputs in 2 variables

Function IsPrime
(Google how to apply this in code.  It's everywhere)


Function reverse
    You can either read the integer value by value into an array or string.  Or, you can use mod/10 to extract the rightmost value of the integer (probably just go with array/string if you're new and haven't learned mods)

Function biggestDigit
    Take the array you used for reverse() and store the first value in a variable. 
    Read in the next value
    If next value > current value
          store next value in the variable
    repeat until you've gone through the entire array.



Honestly, you can literally google ALL of these functions and copy and pasta from google. :/
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll