Edited by Supernature, 11 August 2010 - 04:40 PM.
Paying well for C++ program
Started by Supernature, Aug 11 2010 01:52 PM
8 replies to this topic
#1
Posted 11 August 2010 - 01:52 PM
#2
Posted 11 August 2010 - 01:57 PM
Perhaps you should try doing it yourself rather than waiting for somebody else to appear to do it for you?
#3
Posted 11 August 2010 - 01:58 PM
For the first question you need to write a function PrintAllFactors that will do the following:
for(int i=1; i<=integer/2;i++)
{
if(integer%i==0)
{
cout << i << " "
}
}
All this does is test every integer as a factor and if it is a factor, prints it. I think this is right, I would write it out yourself and test it
for(int i=1; i<=integer/2;i++)
{
if(integer%i==0)
{
cout << i << " "
}
}
All this does is test every integer as a factor and if it is a factor, prints it. I think this is right, I would write it out yourself and test it
#4
Posted 11 August 2010 - 01:58 PM
I'm trying. I've already done two programs. These two are just really hard for me. I don't understand them.
#5
Posted 11 August 2010 - 02:03 PM
EDIT: For the second question, I don't remember how to do handle a CTRL Z halt, but this problem is not much different from the first.
if(integer%2==0)
{
cout << "This number is even"
even++
}
if(integer%2==1)
{
cout << "This number is odd"
odd++
}
Then once you exit the program you just need to have it output
cout << "You entered " << even << " even, and " << odd << " odd numbers."
EDIT: This should be more than enough to set you on the path to finishing these problems, aye?
if(integer%2==0)
{
cout << "This number is even"
even++
}
if(integer%2==1)
{
cout << "This number is odd"
odd++
}
Then once you exit the program you just need to have it output
cout << "You entered " << even << " even, and " << odd << " odd numbers."
EDIT: This should be more than enough to set you on the path to finishing these problems, aye?
#6
Posted 11 August 2010 - 02:18 PM
I'm sure this would make a lot of sense to most programmers but I'm so bad at it, lol. Ugh. Anyone else?
Offering cash
Offering cash
Edited by Supernature, 11 August 2010 - 02:21 PM.
#7
Posted 11 August 2010 - 02:50 PM
Doesn't Ctrl+Z terminate the program? If you have to handle Ctrl+Z by yourself, you will have to write a signal handler, which is much more complicated.
#8
Posted 11 August 2010 - 02:57 PM
failed, nvm.
Edited by Supernature, 11 August 2010 - 04:40 PM.
#9
Posted 11 August 2010 - 03:02 PM
"When cin encounters Ctrl-Z, cin.eof() will return true." (I found it on other website.)
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users