LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-25-2011, 09:23 PM   #1
faizlo
Member
 
Registered: Sep 2008
Location: USA
Distribution: Linux Mint Qiana
Posts: 190

Rep: Reputation: Disabled
Adjusting Konsole


Hi,

I am writing a C++ code that draws a sine curve. The code is fine, but when I run it (the compiled output) I get strange characters for both x- and y- axis. They look like a small oval with a question mark in it. I tried to run in it in a xfce4-terminal and this time, I could not see any of the axis, so I figured it has to do with playing with configuration of either console of Terminal (or gnome-terminal). Here is the code for testing:

Code:
/* ----------------------------------------------------- 
 *   sinCurve.cpp
 *   Outputs a sine curve
 * ----------------------------------------------------- 
*/

#include <iostream>
#include <cmath>                         // Prototypes of sin()
using namespace std;

#define CLS         (cout << "\033[2J") 
#define LOCATE(z,s) (cout <<"\033["<<(z)<<';'<<(s)<<'H')

#define PI        3.1415926536
#define START     0.0                    // Lower limit
#define END     (2.0 * PI)               // Upper limit

#define PNT       64                     // Number of points on the curve
#define STEP  ((END-START)/PNT)
#define xA        14                     // Row  of x-axis
#define yA        10                     // Column of y-axis


int main()
{
  int  row, column;

  CLS;
  LOCATE(2,25);
  cout << "-------  The Sine Function  -------";


  //    ---  Draws the coordinate system: ---  

  LOCATE(xA,1);                               // x-axis
  for( column = 1 ; column < 78  ; ++column)
    {
      cout << ((column - yA) % 8  ?  '\304' : '\305');
    }

  cout << '\020';                             // top
  LOCATE(xA-1, yA+64);  cout << "2PI  x";

  for( row = 5 ; row < 24 ; ++row)            // y-axis
    {
      LOCATE(row, yA);  cout << '\305';
    }

  LOCATE( 4, yA);  cout << "\036 sin(x)";     // top
  LOCATE( xA-8, yA+1);  cout << " 1";
  LOCATE( xA+8, yA+1);  cout << " -1";

  //     ---  Displays the sine function:  --- 

  int begpt = yA,
    endpt = begpt + PNT;

  for( column = begpt ;  column <= endpt  ;  ++column)
    {
      double x = (column-yA) * STEP;
      row = xA - 8 * sin(x) + 0.5;
      LOCATE( row, column);  cout << '.';
    }

  LOCATE(25,1);                 // Cursor to the last row 

  return 0;
}
Any clue?

I am using an Ubuntu 11.10 box updated to the latests of packages.

~faizlo

Last edited by faizlo; 12-25-2011 at 09:24 PM.
 
Old 12-27-2011, 09:50 PM   #2
faizlo
Member
 
Registered: Sep 2008
Location: USA
Distribution: Linux Mint Qiana
Posts: 190

Original Poster
Rep: Reputation: Disabled
OK,

To explain this further.
How to make konsole show the characters corresponding to ASCII codes 134, 135, ...etc. Also how to show the division sign (./.) on the konsole or any other terminal?

I hope this makes my problem more understandable!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Konsole always give SuperUser Konsole - can't get regular shell checkmate3001 Linux - Desktop 3 08-05-2008 10:00 AM
konsole acts as "Root Konsole" ab44045 Linux - General 11 06-11-2007 05:18 PM
6.12. Re-adjusting the Toolchain jobesd Linux From Scratch 2 01-16-2005 01:50 PM
adjusting time under RH trutnev Red Hat 1 03-28-2004 01:56 PM
Adjusting Display Paul Lumagbas Linux - Newbie 2 07-28-2002 04:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration