Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old February 5th, 2006, 03:31 PM
Suzieblue Suzieblue is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Location: Scotland
Posts: 5 Suzieblue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 51 sec
Reputation Power: 0
Pseudocode to count integers

Hi

I need some help. Does anyone know the pseudocode to count integers in a file?

Thanks in advance!

Reply With Quote
  #2  
Old February 5th, 2006, 04:49 PM
edfollett's Avatar
edfollett edfollett is offline
Mystical Monkey with Wings
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: SW1A London UK
Posts: 496 edfollett User rank is Corporal (100 - 500 Reputation Level)edfollett User rank is Corporal (100 - 500 Reputation Level)edfollett User rank is Corporal (100 - 500 Reputation Level)edfollett User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 3 m 40 sec
Reputation Power: 9
a little bit vague! How about giving us the file?

did u mean. How to count the number of values in a file e.g. 10 lines with 10 values or something else?
__________________
To fly a Kite high you have to fly against the wind!

think about it..... deep man deep!!

Current Project
Contact me

Reply With Quote
  #3  
Old February 5th, 2006, 04:51 PM
SimonGreenhill's Avatar
SimonGreenhill SimonGreenhill is offline
(retired)
Dev Shed God 11th Plane (10000 - 10499 posts)
 
Join Date: Dec 2003
Location: The Laboratory
Posts: 10,101 SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 4925 Folding Title: Novice Folder
Time spent in forums: 3 Months 3 Weeks 5 h 41 m 45 sec
Reputation Power: 1331
Facebook
let me guess, it's a homework assignment?

--Simon

Reply With Quote
  #4  
Old February 5th, 2006, 04:56 PM
Suzieblue Suzieblue is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Location: Scotland
Posts: 5 Suzieblue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 51 sec
Reputation Power: 0
It is the number of integers that are in the file not the values. It could be thought of as homework.

Suzie

Reply With Quote
  #5  
Old February 5th, 2006, 04:58 PM
SimonGreenhill's Avatar
SimonGreenhill SimonGreenhill is offline
(retired)
Dev Shed God 11th Plane (10000 - 10499 posts)
 
Join Date: Dec 2003
Location: The Laboratory
Posts: 10,101 SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)SimonGreenhill User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 4925 Folding Title: Novice Folder
Time spent in forums: 3 Months 3 Weeks 5 h 41 m 45 sec
Reputation Power: 1331
Facebook
so what have you tried?

Reply With Quote
  #6  
Old February 5th, 2006, 05:00 PM
edfollett's Avatar
edfollett edfollett is offline
Mystical Monkey with Wings
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: SW1A London UK
Posts: 496 edfollett User rank is Corporal (100 - 500 Reputation Level)edfollett User rank is Corporal (100 - 500 Reputation Level)edfollett User rank is Corporal (100 - 500 Reputation Level)edfollett User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 3 m 40 sec
Reputation Power: 9
yeah come on!

its homework for a reason!! at least give it a go b4 looking for the answer! otherwise ur not gonna learn!

Reply With Quote
  #7  
Old February 5th, 2006, 05:05 PM
Suzieblue Suzieblue is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Location: Scotland
Posts: 5 Suzieblue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 51 sec
Reputation Power: 0
Ok I have not used pseudocode before but here is my effort:

Begin procedure to count how many integers are in the file
Add integers to array list If array = empty Then Msg box show “There is no data in the file”
Statement is true
End If
If statement is false Then
COUNT integers (variables) and loop until no more integers
Store in the variable then output to text box End If
End procedure

Reply With Quote
  #8  
Old February 5th, 2006, 05:21 PM
Suzieblue Suzieblue is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Location: Scotland
Posts: 5 Suzieblue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 51 sec
Reputation Power: 0
How far off the track am I?

Reply With Quote
  #9  
Old February 5th, 2006, 05:29 PM
edfollett's Avatar
edfollett edfollett is offline
Mystical Monkey with Wings
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: SW1A London UK
Posts: 496 edfollett User rank is Corporal (100 - 500 Reputation Level)edfollett User rank is Corporal (100 - 500 Reputation Level)edfollett User rank is Corporal (100 - 500 Reputation Level)edfollett User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 11 h 3 m 40 sec
Reputation Power: 9
you've done ok!

from my experience of writing Pseudocode for Uni they usuaully expect a little bit more detail and evaluation of variables u used.

For example you simply put :

"COUNT integers and loop until no more integers"

By the sounds of it this is the most important part of the Pseudo code and you have wrapped it up in one line.

Personally i would break this down into a While loop

e.g Pseudo code:
int ll_count //counting variable
boolean lb_continue = true

while lb_continue = true (condition = true) // u use a while loop when u do not know how many variables you are reading in.

Read variable in
if exists = false (if there is a value) // you could change this to is it EOF
lb_condition = false //exiting the while loop
else
isit a number // a bit of validation to make sure it is infact a number
if yes
ll_count add one
end if
end if
loop


thats roughly what i would do for that main part. But you still have to go into more detail baout locating the file and opeinging it.

hope that helps!

Reply With Quote
  #10  
Old February 6th, 2006, 12:28 AM
Suzieblue Suzieblue is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Location: Scotland
Posts: 5 Suzieblue User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 51 sec
Reputation Power: 0
Hi

This is really helpful thank you. I will work on it more today.

Suzie

Reply With Quote
  #11  
Old February 6th, 2006, 09:12 AM
LinuxPenguin's Avatar
LinuxPenguin LinuxPenguin is offline
fork while true;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2005
Location: England, UK
Posts: 5,535 LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)LinuxPenguin User rank is General (90000 - 100000 Reputation Level)  Folding Points: 11590 Folding Title: Novice Folder
Time spent in forums: 1 Month 3 Weeks 1 Day 19 h 23 m 58 sec
Reputation Power: 999
In the pseudocode we've used, the only form of loop available was like so

repeat
...
until <condition>

so you'd do something like this

repeat
read line from file 1
if line is an integer
increment numberOfValues
store line in array `values`
end if
until numberOfValues = 10

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Pseudocode to count integers


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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