| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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." |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
pay me $50.00 please im ownley 11 years old!
Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Need help in C programming |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|