C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 19th, 2004, 06:26 PM
giggles_l87 giggles_l87 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 1 giggles_l87 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Need help in C programming

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int get_int(void);

int main(void)
{
int num;
printf("Enter some integers. When you are done, enter 0 (zero).\n");

while ( (num=get_int()) != 0)
{
printf("I got the number %d.\n", num);
}

return 0;
}

int get_int(void)
{
char ch;
int input;

while(scanf("%d", &input) !=1)
{
while((ch = getchar()) != isspace(' ') || != isspace('A'))
while(!isspace(ch=getchar()))
putchar (ch);
printf("is not an integer.\nPlease enter an ");
printf("integer value");
}

return input;
}
What I want my program to show as the output is :
any integers entered by the user
then "I got the number (the integer entered by the user)"
when the user enters zero it should say "Zero is not an integer. Please enter an integer value."




Reply With Quote
  #2  
Old July 20th, 2004, 10:58 PM
dockies_direx dockies_direx is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 2 dockies_direx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to dockies_direx
question

include<iostream.h>
include<iomanip.h>
int main()
int a,b,c;
cout>>"Enter 1st Integer:"
cin<<a;
cout>>"Enter 2nd Integer:"
cin<<b;

my question is my program if it is right in finding the Prime numbers
because im a new learner of C++ i hope someone could check
my error and could help me.

Reply With Quote
  #3  
Old August 14th, 2004, 10:50 PM
D12 D12 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 1 D12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
pay me $50.00 please im ownley 11 years old!

Quote:
Originally Posted by dockies_direx
include<iostream.h>
include<iomanip.h>
int main()
int a,b,c;
cout>>"Enter 1st Integer";
cin<<a;
cout>>"Enter 2nd Integer";
cin<<b;

my question is my program if it is right in finding the Prime numbers
because im a new learner of C++ i hope someone could check
my error and could help me.
thats what you did wrong

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Need help in C programming


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT