473,395 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

C++ program to print how many positive numbers are entered, how many negative numbers

1
Write a program that asks the user to enter 10 integers.
The program should print how many positive numbers are
entered, how many negative numbers are entered and how
many zeros are entered.
how do I solve this using do or while or for statements ? :/
Jul 19 '16 #1
2 1359
weaknessforcats
9,208 Expert Mod 8TB
Do this by degrees.

First, in your main() write a loop that cycles 10 times.

Get this working then post again.
Jul 20 '16 #2
donbock
2,426 Expert 2GB
What do you want your program to do if the user enters something invalid?
There are two kinds of invalid: nothing about the input looks like an integer; and the input is an integer that is followed by non-integer characters.
Jul 21 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: pj | last post by:
Why does M$ Query Analyzer display all numbers as positive, no matter whether they are truly positive or negative ? I am having to cast each column to varchar to find out if there are any...
4
by: Charles A. Lackman | last post by:
Hello, I have some textboxes that are doing addition: Dim AString As Double AString = Convert.ToDouble(TextBox1.Text) - Convert.To(DoubleTextBox2.Text) TextBox3.Text =...
5
by: Gidi | last post by:
Hi, I've DataGrid which the user can enter numbers, when it comes to possitive numbers I have no problem, But when I enter negative numbers instead of writing -x it write x- (the minues sign is...
39
by: Frederick Gotham | last post by:
I have a general idea about how negative number systems work, but I'd appreciate some clarification if anyone would be willing to help me. Let's assume we're working with an 8-Bit signed integer,...
2
by: Jack Wales | last post by:
I need to set up a text box in Visual Basic which will only allow positive numbers and will produce an error message if 1 - A negative number is entered, 2 - something not numeric is entered and 3 -...
4
yosiro
by: yosiro | last post by:
I have a module to convert numbers (in positive value) into My Language (indonesian) words below: Option Compare Database Public Function ubah_terbilang(xbil As Double) Dim nilai, i, j, k,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.