Console display

Started by Ryszard, April 22, 2021, 11:23:05

Previous topic - Next topic

Ryszard

Good morning!

How to display calculation results horizontally in the console. A lot of results.

Henri

#1
Morning,

do you mean in cmd console or in MaxIDE console ?

Edit: And by horizontally you probably mean vertically ?

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Dabz

#2
Not sure what your after, do you mean format it like, as in, tables...


Const COLUMNS_AMOUNT = 5
Const ROWS_AMOUNT = 2

Local row:String
Local dataItem:Int
Local VSeperator:String = "|"

row$ = "ID"[..7]+VSeperator

For Local loop:Int = 1 To COLUMNS_AMOUNT
row$ = row$ + ("Data "+String(loop))[..7]+VSeperator
Next

Print row$

RestoreData TempData

For Local loopRow:Int = 1 To ROWS_AMOUNT
row$ = String(loopRow)[..7]+VSeperator
For Local loopColumn:Int = 1 To COLUMNS_AMOUNT
ReadData dataItem
row$ = row$ +String(dataItem)[..7] + VSeperator
Next
Print row$
Next

#TempData
DefData 1764,6753,2,4567,3235
DefData 123,677,345,77789,345


There's probably libs out there that will handle this better, SQL setups etc, but, off the top of my head, this is how I would display that setup in a console natively... Probably needs a tidy like! :D

Anyway, your question is a bit vague, so, if its not that, then... Can you expand on what you want to actually do? It would go a long way! ;) :P

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Ryszard

As on other Basic, results are displayed after a comma or semicolon.

Midimaster

instead of a lot of PRINT build a string from the single values and print this at the end
print "A=" + a%
print "B=" + b%
print "C=" + c%


local t:STRING=""
t=t+ "A=" + a%
t=t+ "B=" + b%
t=t+ "C=" + c%
print t
...back from Egypt

Henri

Here you go:

Code (blitzmax) Select

Local result:String

For Local i:Int = 65 To 80
If result Then result:+ " --- "
result:+ i + " = " + Chr(i)
Next

Print result


-Henri
- Got 01100011 problems, but the bit ain't 00000001

Ryszard

You misunderstood me, gentlemen, I just gave an example that I wanted it to look like this And the data is from various programs, even from my thresholding, I would like something to be displayed as the thresholds are processed, the number of pixels removed, and so on. And for each picture in one line.

Henri

Did you try my example ? It gathers results in one line (like you asked). What information you fill is up to you. I just used information shown in your example.

You can append to a string variable with assign operator :+ and when you are ready, just print your results and reset the variable with result = "".

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Dabz

#8
Are you looking for something like this...


Graphics 640,480

Const COLUMNS_AMOUNT = 10
Const ROWS_AMOUNT = 10

Local VSeperator:String = "|"

Repeat
Cls
For Local loopRow:Int = 1 To ROWS_AMOUNT
row$ = ""
For Local loopColumn:Int = 1 To COLUMNS_AMOUNT
row$ = row$ +String(Rand(1,100))[..7] + VSeperator 'Using just random ints to update cell data
Next
DrawText row$,0,loopRow*16
Next
Flip
Until KeyDown(KEY_ESCAPE)


???

Obviously you'll have to change this:-


row$ = row$ +String(Rand(1,100))[..7] + VSeperator


to implement your own data or formatting.

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit