cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
need some guidance.....
need some guidance.....
Oct 28, 2011 at 9:43pm UTC
jjSalva19
(3)
i got a file with some numbers for example 1234 and 3302 and i need to add 1+2+3+4 to equal 10 and lets say 3+3+0+2 equal 8. i got this while loop but how do I use a counter and where do i put it..to add the digits and show on an output 6 and 8
while(fin>>number)
{
if(number<=0)
{
cout<<"bad data"<<number<<endl;
continue;
}
fout<<number<<endl;
while(number > 0 )
{
remainder =number % 10;
number = number / 10;
}
Oct 29, 2011 at 1:11am UTC
markyrocks
(346)
All I can recommend is reading a bunch of tutorials and maybe a c++ book or two.
Topic archived. No new replies allowed.