Hi
Basically I am print out a group of number with a certain increment. However I found out a wierd thing happened from the result
The code I wrote:
Dim number1, number2, counter, increment As Double
Console.Write(" Enter number1:")
number1 = Console.ReadLin e
Console.Write(" Enter number2:")
number2= Console.ReadLin e
Console.Write(" Enter increment: ")
increment = Console.ReadLin e For count = lower_flow_rate To upper_flow_rate Step increment
count = count + increment
Console.WriteLi ne("{0:F}", count)
next
I was trying to print out a group of number from 0.8-1.5 with the increment of 0.05. However when the result came out it's 0.85,0.95, 1.05, 1.15,1.25, 135.1.45. and the increment is not 0.05 but 0.1.
But when i try any number that is great than 1, it works. Fox example number from 1.0-1.5, all the numbers that are printed out are with the 0.05 increment.
I got really confused here.
can anyone plz help me with this
Really appreciate!!!
1 1443
Just a quick one to think about - your DIM statement may not be producing exactly what you expect. Keeping in mind that I don't know what version of BASIC you're working with, in my one (VB6) this statement: - Dim number1, number2, counter, increment As Double
would create increment as a Double, and the rest as whatever the default type is (probably Variant). Perhaps you could try this, just to see whether it makes any difference: - Dim number1 As Double, number2 As Double, counter As Double, increment As Double
This is just a general tip - make sure you know what your code is doing, before you decide it shouldn't be doing it. :)
I have no idea whether this will help in your specific case.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ken Fine |
last post by:
I'm looking to find or create an ASP script that will take a string, examine
it for a search term, and if it finds the search term in the string, return
the highlighted search term along with the words that surround it. In other
words, I want the search term highlighted and shown in an excerpt of the
context in which it appears.
Any suggestions or pointers? This behavior is most often seen as part of a
search engine. In my case, I want...
|
by: kazio |
last post by:
Hello,
So, I need to have double linked, circular list (last element point to the
first one and first one points to the last one). I thought maybe I could
use list container from STL, but unfortunately probably not. I checked it,
and when I increase (++) iterator pointing to the last element the program
crashes.
I know the standard says, this is a linear list (with beginning and the
end), but I completely don't understand why they...
|
by: pertheli |
last post by:
Hello,
I have a large array of pointer to some object. I have to run test
such that every possible pair in the array is tested.
eg. if A,B,C,D are items of the array,
possible pairs are AB, AC, AD, BC and CD.
I'm using two nested for loop as below, but it is running very slow
whenever I access any data in the second loop.
|
by: deko |
last post by:
I use a For Each... Next loop like this:
For Each varFnm In Array("This", "That", "OtherThing", "Foo", "Bar")
RunSql ("UPDATE.... bla bla bla)
Next
But the exact same elements of the Array are contained in a Table -- Is
there some way to use a query to set the Array, or some other way to avoid
using the Array?
|
by: NC Tim |
last post by:
Hello,
I think the question i have is fairly straightforward, but I can't seem to
replicate the old SAS frequency procedure when I try to accomplish this in
MS Access.
anyway, i have about 10 questions on a survey that have a possible response
range from 0-4.
what I would like to do is simply show that for each question we had x
amount of responses in each category, which amount to x percentage of all
| |
by: J L |
last post by:
I have defined a structure
private structure FieldInfo
dim FieldName as string
dim OrdinalPostioin as Integer
dim DataType as Type
dim Size as Integer
end structure
I read this information from a DataReader which retrieves schema info
|
by: mabond |
last post by:
Hi
My application browses the contents of a network directory and displays any
powerpoint file found in the directory. On completion it returns to the start
and begins again.
The following is a snippet of the code that is used to get the name of the
file before it is displayed.
Dim fs, f, fc, f1
|
by: me |
last post by:
Hi All,
I am new to Classes and learniing the ropes with VB.NET express
Here's my question - say I have a want to manage a list of books.
Each book has an Author, Title and ISBN
Now, I am used to using Arrays so I would normally do something like this:
Set an array up during the init routine (called from form_load) say of
|
by: the other john |
last post by:
I'm trying to enhance a script to do the following things.
1). detect the first four words of a paragraph and stylize them
(already does that)
2). Capitalize and stylize the first letter of each paragraph (already
does that via style sheet)
3). Count the number of paragraphs (or number of "vbcrlf & vbcrfl") so
I can insert a images in specific places (i.e. I want to dynamically
insert image 1 in paragraph 1, image 2 into para 2, etc.)
|
by: Cesar G. Miguel |
last post by:
I've been studying python for 2 weeks now and got stucked in the
following problem:
for j in range(10):
print j
if(True):
j=j+2
print 'interno',j
What happens is that "j=j+2" inside IF does not change the loop
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |