Yes, I can do that, but the question specifically says "one object". I think this is just a mistake by my instructor. Thanks for your help. :)
Type: Posts; User: .C-Man.
Yes, I can do that, but the question specifically says "one object". I think this is just a mistake by my instructor. Thanks for your help. :)
Oh sorry, I didn't realize that... Yes, frA is an object but why is it asking me to create an object if there already is one?
Yes, but the question asks if there isn't any errors in the provided code (This code was already given) then I should fill in code to create an object. Is there an object already?
(a) Is/Are there error(s) with the following class definition and/or object creation? If no, provide code to create ONE object. If yes, please provide your explanation for credit.
#include...
I don't get how it can print multiple indexes that smallDigit and largeDigit are on, with one int.
This is my code:
int numbers[10];
int count;
int smallDigit = 9;
int largeDigit = 0;
...
Do you think using a pointer would help in this situation?
Thanks, I found that out, but can I still apply this if the number is printed out on multiple indexes?
I misunderstood my assignment earlier. I now understand for the part with :
The smallest digit: 0
Digit 1 can be found in integer number(s): 3
The largest digit: 9
Digit 9 can be found in...
I'm really sorry, I'm not that good with C++ terminology can you please explain what you said through my code?
Ok, I understand this... but how does that help me with printing the right index when there is a number present in the index?
Like this?
int numInt;
for(i = 0; i < count; i ++){
cout << "\t\tEnter integer #" << i + 1 << " : ";
cin >> numbers[i];
I mean I initialized it so inside the for loop I could have an unlimited amount of numbers no matter what I enter. Anyway, it works, that's not my problem...
I don't understand what you mean...
I do int numbers[0] to initialize it, then "i" takes over as the number in the array.
I know how to extract numbers from each integer # but I don't know how to make it print so it says which line...
Hey guys, basically I need to extract 2 numbers, a small and large number chosen by using cin to input, in an array.
Example:
How many integers? 3
Enter integer #1: 12795
Enter...
Thanks a lot for all the help and the time you took out to help me. It probably took a lot of patience to put up with my amateurism. Thanks again! :D
Ok I found the solution. I initialized 'total' (my int for finding the combined total of all numbers) to equal 0 then I did this:
if( num != 0 ){
while (num != 0){
currentNum = num %...
Also, if you don't mind, can you help me with one more thing? In this code I also need to find out how to find the total of all numbers extracted from 'num'.
How about this?
if( num != 0 ){
while (num != 0){
current1 = num % 10;
num /= 10;
cout <<"curr:" << current1 << endl;
if( current1 > largeNum ){
largeNum = current1;
Ok, I figured it out for the most part :
while (num != 0){
current1 = num % 10;
num /= 10;
cout <<"curr:" << current1 << endl;
if( current1 > largeNum ){
largeNum = current1;
Ok, so with
if( current1 > largeNum ){
largeNum = current1;
}
if( current2 > largeNum ){
largeNum = current2;
}
largeNum should be initialized to 0 and smallNum to 9... but why would we need to initialize them if we are making them current1 and current2 from this first pair?
It was stored into largeNum and smallNum... Ohh, so do I compare smallNum and largeNum to current1 and current2?
if( current1 > current2 ){
largeNum = current1;
smallNum = current2;
}
if( current2 > current1 ){
largeNum = current2;
smallNum = current1;
}
To check which one is the...
We would compare them like this:
if( current1 > current2 ){
largeNum = current1;
smallNum = current2;
}
I would compare the first 2 numbers and see which one is biggest and smallest and remember, then I would compare the numbers from the next pair to the 1st pair and see which one is the biggest and...