Click here to Skip to main content
15,929,346 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProgramming problem Pin
Anonymous19-Dec-02 3:38
Anonymous19-Dec-02 3:38 
GeneralRe: Programming problem Pin
Maximilien19-Dec-02 3:50
Maximilien19-Dec-02 3:50 
GeneralRe: Programming problem Pin
Anonymous19-Dec-02 3:59
Anonymous19-Dec-02 3:59 
GeneralRe: Programming problem Pin
AlexO19-Dec-02 4:52
AlexO19-Dec-02 4:52 
GeneralRe: Programming problem Pin
Michael P Butler19-Dec-02 3:53
Michael P Butler19-Dec-02 3:53 
GeneralRe: Programming problem Pin
Rage19-Dec-02 3:54
professionalRage19-Dec-02 3:54 
GeneralRe: Programming problem Pin
Joe Woodbury19-Dec-02 5:18
professionalJoe Woodbury19-Dec-02 5:18 
GeneralRe: Programming problem Pin
Anonymous19-Dec-02 5:33
Anonymous19-Dec-02 5:33 
//I have now come up with the following but it still is not working properly:

int main()
{
int digit;
int sum;
int Total;
int num;

cout << "Enter a five digit number followed by enter: " ;
cin >> digit;
for (int i=4; i>=0; i--)
{
int p = pow(10,i);
num=digit/p;
digit=digit%p;
sum = sum + num;
}

cout << "The sum is " << sum << endl;

//Something is wrong with the sum = sum + num line. The previous lines work properly.
GeneralRe: Programming problem Pin
Joe Woodbury19-Dec-02 5:45
professionalJoe Woodbury19-Dec-02 5:45 
GeneralRe: Programming problem Pin
Anonymous19-Dec-02 7:23
Anonymous19-Dec-02 7:23 
GeneralRe: Programming problem Pin
Joe Woodbury19-Dec-02 10:17
professionalJoe Woodbury19-Dec-02 10:17 
GeneralOpen file Pin
duvaft19-Dec-02 3:06
duvaft19-Dec-02 3:06 
GeneralRe: Open file Pin
Joe Woodbury19-Dec-02 5:20
professionalJoe Woodbury19-Dec-02 5:20 
GeneralCSocket multithreading[urgent] Pin
junni19-Dec-02 2:47
junni19-Dec-02 2:47 
GeneralRe: CSocket multithreading[urgent] Pin
Rage19-Dec-02 2:48
professionalRage19-Dec-02 2:48 
GeneralRe: CSocket multithreading[urgent] Pin
junni19-Dec-02 3:02
junni19-Dec-02 3:02 
GeneralRe: CSocket multithreading[urgent] Pin
Daniel Turini19-Dec-02 3:03
Daniel Turini19-Dec-02 3:03 
GeneralRe: CSocket multithreading[urgent] Pin
Brian Delahunty19-Dec-02 3:53
Brian Delahunty19-Dec-02 3:53 
GeneralRe: CSocket multithreading[urgent] Pin
Nish Nishant19-Dec-02 6:28
sitebuilderNish Nishant19-Dec-02 6:28 
GeneralRe: CSocket multithreading[urgent] Pin
junni19-Dec-02 18:55
junni19-Dec-02 18:55 
GeneralRe: CSocket multithreading[urgent] Pin
RobJones19-Dec-02 9:32
RobJones19-Dec-02 9:32 
GeneralRe: CSocket multithreading[urgent] Pin
junni19-Dec-02 18:58
junni19-Dec-02 18:58 
GeneralWriting hex to a file Pin
Franz Klein19-Dec-02 2:28
Franz Klein19-Dec-02 2:28 
GeneralRe: Writing hex to a file Pin
David Chamberlain19-Dec-02 3:09
David Chamberlain19-Dec-02 3:09 
GeneralGetting Access to the Desktop Wallpaper Pin
Waleed Eissa19-Dec-02 2:23
Waleed Eissa19-Dec-02 2:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.