0

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:

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by Siersan
0

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.

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.