Well if you wanted to use a for loop instead on a while loop than I think you would have to do it like this:
for (int num=0; num<=36; num+=4) // since I believe you have to go by four.
{
if (strange(num))
cout<<"True"<<e ndl;
else
cout<<"False"<< endl;
}...
User Profile
Collapse
-
Your absolutely correct every time it goes through the loop 4 is added to the number and it turns out just as you have said it.
Then the function decideds whether the remainder of that number divided by 2 is 0 as well as the remainder of that number divided by 3 is 0 and if both of these remainders are 0 then and only then will the function return true, otherwise it returns false.
So it will only return true for the numbers that...Leave a comment:
-
That was absolutely correct I can't believe I missed that. It worked out perfectly , Im using Dev-C++ and double mass[n] workes with no problem. I just got confused how i was suppose to declare an array of words, I wasnt sure you can have an array or words and not just characters.
Thank you very muchLeave a comment:
-
From what I know its the mod operator and so far I only know that you can use it for finding the reminder. Im not sure if it has any other uses. Maybe someone more knowledgeable can answer that question better.
= )...Leave a comment:
-
The purpose of placing the % is that ur asking for the remainder after the number is divided by 2. If the remainder is 0 then the number is even. e.g if you do 10 % 6 than that would give you 4.
Hope it helped...Leave a comment:
-
Im not exactly sure if this is what you wanted since im new at this but i got the program to stop being in an endless loop and you can fix up the rest from here.
Here it is:
#include<iostre am>
#include<fstrea m>
using namespace std;
void menu();
int read_accts(int [], double [], int);
void withdrawal(int [], double [], int);
void deposit(int [], double [], int);...Leave a comment:
-
Problem with reading in a word
I have wrote the program and it worked fine until I had to include one more array into it. As you can see below the two arrays of volume and mass are working properly now I need to include a third array which reads in the sample name that coincides with the mass and the volume. I have tried the getline function and that didnt work. This is my first class in computer programming and im very new to it so if i have made obviouse mistakes i apologize....
No activity results to display
Show More
Leave a comment: