NO

Author Topic: superscript and subscript  (Read 8717 times)

boral

  • Guest
superscript and subscript
« on: February 18, 2012, 05:22:29 PM »
How can I write superscript and subscript in C ?
Infact is it possible to write superscript and subscript in C ?

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: superscript and subscript
« Reply #1 on: February 19, 2012, 05:57:11 AM »
How can I write superscript and subscript in C ?
Infact is it possible to write superscript and subscript in C ?
Well, C by itself doesn't know squat about superscript or subscript in general, so the short answer would be: No.

If you refer to showing those in either printed output or Windows dialogs/text, then the answer is: yes (or maybe)...

Ralf

boral

  • Guest
Re: superscript and subscript
« Reply #2 on: February 19, 2012, 07:21:55 AM »
Bitbeisser, I want to show those in printed output. How will I do that? The program is this and I want to write a11,a12,a13,a21,a22,a23,a31,a32,a33,D3  as  a11,a12,a13,a21,a22,a23,a31,a32,a33,D3 in printed output.

include<stdio.h>
main()
{
float a11,a12,a13,a21,a22,a23,a31,a32,a33,D3;
     printf("Enter values of a11,a12,a13,a21,a22,a23,a31,a32,a33 successively with a space and then press enter.\n");
     scanf("%f%f%f%f%f%f%f%f%f",&a11,&a12,&a13,&a21,&a22,&a23,&a31,&a32,&a33);
      D3 = a11*(a22*a33-a32*a23)-a21*(a12*a33-a32*a13)+a31*(a12*a23-a22*a13);  //formula of determinant of third order//
   printf("The value of the determinant is = %f\n",D3);
   }

iZzz32

  • Guest
Re: superscript and subscript
« Reply #3 on: February 19, 2012, 01:33:19 PM »
Use U+2080 and others and UTF-8 output (to a file, as your console font probably does not support those glyghs).

boral

  • Guest
Re: superscript and subscript
« Reply #4 on: February 19, 2012, 05:27:08 PM »
iZzz32, will you please explain what are U+2080 and others and UTF-8 output ?

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: superscript and subscript
« Reply #5 on: February 19, 2012, 05:53:27 PM »
Bitbeisser, I want to show those in printed output. How will I do that?
Still depends on what exactly you mean by "printed" output.

Your example shows output to a console Windows (as we are talking Pelle's C here in this forum, which is a Windows only implementation of a C compiler). That might be a bit more than tricky at the very least.

Basically, iZzz32 gave you an answer, that the font your Windows command prompt is set to doesn't very likely support those Unicode characters.
U+2080 was his example for such a Unicode character (subscript zero to be exact) and UTF-8 is one of the Unicode sets commonly used in Windows.

Printing in Windows, be it either to the screen or to a printer is FAR more complicated than in the good old days of text based output screens and dot matrix printers.
You question in general seem to be more related to the peculiarities of doing such things in Windows than specifically to (Pelle's) C...

Ralf

CommonTater

  • Guest
Re: superscript and subscript
« Reply #6 on: February 19, 2012, 06:32:15 PM »
How can I write superscript and subscript in C ?
Infact is it possible to write superscript and subscript in C ?

As Bitbessier has alluded... In a console mode program the short answer is "No, not possible".
The windows console display doesn't know how to do that.

If you are working in a GUI mode environment, yes it is possible... in fact, advanced text formatting is one of the reasons the whole GUI thing was invented.


boral

  • Guest
Re: superscript and subscript
« Reply #7 on: February 20, 2012, 06:23:38 PM »
Thank you all for your answers.