Have been issued a problem. 'Design a program using the top down stepwise refinement. This should include a structure chart and pseudo code' The program is to control a temperature process, with two reference temperatures. Dont understand a word of this - can anyone help PLEASE? :sad:

Member Avatar for Siersan

A structure chart is just a flowchart. Pseudocode is equally simple, it is just a structured way of describing your logic. You don't need to follow any strict rules since it is not designed to be compiled. For example, I could write the code to print the numbers 1 to 10 in pseudocode like this:

BEGIN
  i := 1
  WHILE i < 10 DO
    PRINT i
    PRINT ' '
    i = i + 1
  LOOP
END

C++ code can be derived from that logic without too much difficulty:

#include <iostream>

using namespace std;

int main()
{
  int i = 1;

  while (i < 10) {
    cout<< i <<' ';
    ++i;
  }
}

And then the C++ code can be improved once you have something working:

#include <iostream>

using namespace std;

int main()
{
  for (int i = 0; i < 10; i++)
    cout<< i <<' ';
}

Top-down stepwise refinement is a fancy way of saying that you start designing without assuming any details and then add more detail bit by bit.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.