• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Printing a line only once in a method

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I have this code that is supposed to print truth tables you'd encounter in a discrete math course. The code is as follows.

but the output is

b0 b1 b0 AND b1
b0 b1 b0 OR b1

true true true
true false false
false true false
false false false
b0 b1 b0 AND b1
b0 b1 b0 OR b1

true true true
true false true
false true true
false false false


Im trying to make it look like this

b0 b1 b0 AND b1
true true true
true false false
false true false
false false false
b0 b1 b0 OR b1
true true true
true false true
false true true
false false false


I've already figured out one way to do it

But im wondering if their is a way to print this using only the method

To try and make this code appear less...chunky.
 
Saloon Keeper
Posts: 9742
80
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

 
No holds barred. And no bars holed. Except this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic