The Artima Developer Community
Sponsored Link

C# Answers Forum
help me - quit option

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Alex

Posts: 4
Nickname: alex107
Registered: Aug, 2003

help me - quit option Posted: Aug 19, 2003 11:13 PM
Reply to this message Reply
Advertisement
hello,
i am making this program. it reads in a number from the user then asks them if they want to enter another number, i want this repeat until the user says no, i used a do while loop but i can't get it working. please help.. the code is as follows:

#include <stdio.h>

main()
{

int temp = 0;
int temptotal = 0;
char quit = 'y';

do
{

printf("Please enter the temperture:\n");
scanf("%d", &temp);

temptotal = temptotal + temp;

printf("Would you like to enter another temperture (y for yes / n for no)?\n");
scanf("%c", &quit);

} while (quit != 'n');

}

Topic: register ocx ce.net Previous Topic   Next Topic Topic: OpenGL and C#

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use