Is Relational Operator Usage in Pseudo-Code Valid?

  • Thread starter Thread starter mdnazmulh
  • Start date Start date
  • Tags Tags
    Writing
Click For Summary
SUMMARY

The discussion centers on the validity of using relational operators in pseudo-code, specifically examining a C++ example. Participants confirm that using operators like '>' in pseudo-code is acceptable, as pseudo-code lacks strict rules. The conversation highlights that while detailed pseudo-code can be informative, it often defeats the purpose of being a simplified outline. Ultimately, the consensus is that pseudo-code should remain abstract and not overly detailed.

PREREQUISITES
  • Understanding of basic programming concepts, particularly in C++
  • Familiarity with pseudo-code and its purpose in programming
  • Knowledge of relational operators such as <, >, and their usage
  • Basic principles of algorithm design and outlining code
NEXT STEPS
  • Explore best practices for writing effective pseudo-code
  • Learn about algorithm design techniques in programming
  • Study the differences between pseudo-code and actual programming languages
  • Investigate common pitfalls in pseudo-code writing and how to avoid them
USEFUL FOR

Beginner programmers, computer science students, and educators teaching algorithm design and pseudo-code writing.

mdnazmulh
Messages
51
Reaction score
0
I have just started computer programming in this running semester. So, I'm not experienced in writing pseudo-code. I have one thing to ask. Look at the following c++ statements:

if (x>10)
count<<"x is greater than 10"<<endl;

Can I replace these c++ statements by the following pseudo-code?

If x>10 (Look, i used relational operator in pseudo-code. Is it valid?)
print "x is greater than 10"
 
Technology news on Phys.org
Sure, it's fine. Pseudocode doesn't have any hard-and-fast rules by its nature, but using < and > along with other basic operators like + is just fine.
 
I imagine your example is very theoretical is is just used to illustrate the idea of pseudo code for a class or something?

Because nobody in their right mind would write pseudo code that detailed, it is 6 chars short of the real code! Imagine writing a code outline for a chess game with that much detail. You might as well just write the game itself.

k
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 23 ·
Replies
23
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 89 ·
3
Replies
89
Views
6K
Replies
19
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 11 ·
Replies
11
Views
1K
Replies
10
Views
2K