0

Hi! to everyone
I'm starting out in programming,I need a pseudocode or flowcharting to use to help me get started on coding. Often, when I take a look at a coding assignment, it looks daunting, and it's hard to figure out exactly where to start. Especially with all of that specific code syntax.I need a Pseudocode that will let me focus on the algorithm - the problem solving technique - without letting the actual code syntax get in the way.For the following program that I want to design

Daily Life Magazine wants an analysis of the demographic characteristics of its readers. The Marketing department has collected reader survey records in the following format:

MAGAZINE READER FILE DESCRIPTION
File name: MAGREADERS
Not sorted
FIELD POSITIONS DATA TYPE DECIMALS EXAMPLE
DESCRIP
Age 1-3 Numeric 0 38
Gender 4 Character F
Marital status 5 Character M
Annual income 6–11 Numeric 0 45000
Can you help me with the pseudocode for the program that would produce a count of readers by age groups as follows: under 20, 20 – 29, 30 – 39, 40 – 49, and 50 and older. Print appropriate headings.
I will be grateful if you can help here.

Eager StudentC

4
Contributors
9
Replies
11
Views
12 Years
Discussion Span
Last Post by diannetots
0

Rule 5. Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.

Have you begun to set up a data type? (And you may want to mention the language -- C or C++.)

0

C#,C OR C++, But I need a pseudocode not you do the coding for me or flowchart.Yes I have begun it.Eager Student

0

Lisen friend
I'm starting out in programming,I need a pseudocode or flowcharting to use to help me get started on coding. Often, when I take a look at a coding assignment, it looks daunting, and it's hard to figure out exactly where to start. Especially with all of that specific code syntax.I need a Pseudocode that will let me focus on the algorithm - the problem solving technique - without letting the actual code syntax get in the way.

0

Look, I'm trying to help, and I don't really care for your attitude either. I've told you the best place to start and you refuse to acknowledge it. Building on that, I'd come up with this "pseudocode" (but I don't think in psuedocode because I find that the C languages are wonderful design tools and skip the middleman approach).

void count_by_age_group(struct record* data, int count)
{
   int range[5] = {0};
   while ( count-- )
   {
      if ( data->age < 20 )
      {
         ++range[0];
      }
      else if ( data->age < 30 )
      {
         ++range[1];
      }
      else if ( data->age < 40 )
      {
         ++range[2];
      }
      else if ( data->age < 50 )
      {
         ++range[3];
      }
      else
      {
         ++range[4];
      }
   }
}

I ain't gonna get all graphical with some silly flowchart when it would essentially say the same thing as this: loop through the data and bump a counter for age ranges -- kinda like the assignment says.

[Don't take this as an insult, I think we've both been rubbed the wrong way.]

0

Thank you Dave, I highly appreciate your help here man.I have a clear shout now.

Look, I'm trying to help, and I don't really care for your attitude either. I've told you the best place to start and you refuse to acknowledge it. Building on that, I'd come up with this "pseudocode" (but I don't think in psuedocode because I find that the C languages are wonderful design tools and skip the middleman approach).

void count_by_age_group(struct record* data, int count)
{
   int range[5] = {0};
   while ( count-- )
   {
      if ( data->age < 20 )
      {
         ++range[0];
      }
      else if ( data->age < 30 )
      {
         ++range[1];
      }
      else if ( data->age < 40 )
      {
         ++range[2];
      }
      else if ( data->age < 50 )
      {
         ++range[3];
      }
      else
      {
         ++range[4];
      }
   }
}

I ain't gonna get all graphical with some silly flowchart when it would essentially say the same thing as this: loop through the data and bump a counter for age ranges -- kinda like the assignment says.

[Don't take this as an insult, I think we've both been rubbed the wrong way.]

0

Hi Eager,

I can't understand from your question how the output should be organized. I will help you with a function that reads records from file using your format and stores them in a vector. You can use this vector to play with the data.

Code:

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;

struct Record
{
int  age;		// Pos 1-3
char gender;        // Pos 4
char marital;        // Pos 5
int  income;         // Pos 6-11
};

void ReadInfo(vector<Record> &oPopulation)
{
             	ifstream infile;
	infile.open("C:\\magazine.TXT");
	
	string aRow;
	while (infile >> aRow)
	{
	Record sRec; // example 012MS000120

	string szAge	= aRow.substr(0, 3);
	sRec.age		= atoi(szAge.c_str());
	sRec.gender	= aRow[3];
	sRec.marital	= aRow[4];
	string szIncome	= aRow.substr(5, 6);
	sRec.income	= atoi(szIncome.c_str());

	oPopulation.push_back(sRec);
	}

}

<< moderator edit: added [code][/code] tags >>

0

can you help me to use a flowchart and pseudocode that the output is the sum of the first 10 number the output is 55
flowchart example:

start
int num1 ans
input num1;
ans=num1%?;
a
if
ans==0
output"even"
output"odd"
end

pseudocode
start
in a,b=3,c=4;
output "what is the output";
if
b<=c, ----> a=c b=3 * c, output a,c,
a=c, b=3*c, output a, end

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.