Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Subscript 2 in C++?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Blazin
Grandmaster Cheater
Reputation: 0

Joined: 17 Sep 2006
Posts: 770
Location: Somewhere over the rainbow.

PostPosted: Sat May 10, 2008 7:50 pm    Post subject: Subscript 2 in C++? Reply with quote

IS it possible to make a subscript 2 in C++?
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat May 10, 2008 9:32 pm    Post subject: Reply with quote

You mean this ² ??
_________________
Back to top
View user's profile Send private message
Blazin
Grandmaster Cheater
Reputation: 0

Joined: 17 Sep 2006
Posts: 770
Location: Somewhere over the rainbow.

PostPosted: Sat May 10, 2008 10:00 pm    Post subject: Reply with quote

lurc wrote:
You mean this ² ??

Yes.
Back to top
View user's profile Send private message
HalfPrime
Grandmaster Cheater
Reputation: 0

Joined: 12 Mar 2008
Posts: 532
Location: Right there...On your monitor

PostPosted: Sat May 10, 2008 10:18 pm    Post subject: Reply with quote

That's a superscript...
And do you mean in the command prompt or in code or something?

_________________
Back to top
View user's profile Send private message
Estx
Expert Cheater
Reputation: 0

Joined: 04 Mar 2008
Posts: 172

PostPosted: Sun May 11, 2008 6:22 am    Post subject: Reply with quote

The Unicode character byte for Superscript Two is 0xB2 (178).
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun May 11, 2008 10:32 am    Post subject: Reply with quote

or just actually put the charecter in the string... >_>

Hold Alt and press 0178 on your numpad then let go of alt and the superscript 2 will pop up.

_________________
Back to top
View user's profile Send private message
Blazin
Grandmaster Cheater
Reputation: 0

Joined: 17 Sep 2006
Posts: 770
Location: Somewhere over the rainbow.

PostPosted: Sun May 11, 2008 10:38 am    Post subject: Reply with quote

lurc wrote:
or just actually put the charecter in the string... >_>

Hold Alt and press 0178 on your numpad then let go of alt and the superscript 2 will pop up.


Eh, well is there anyway to make a subscript? I don't really need a superscript
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun May 11, 2008 10:42 am    Post subject: Reply with quote

₂ <-- that?

its unicode byte is 0x2082 (8322)

but thers no alt code for it so you'll have to copy and paste or set the charecters manually.

btw, Windows has this awesome program called Character Map.
It has most of your charecters all you have to do is look Wink

_________________
Back to top
View user's profile Send private message
Blazin
Grandmaster Cheater
Reputation: 0

Joined: 17 Sep 2006
Posts: 770
Location: Somewhere over the rainbow.

PostPosted: Sun May 11, 2008 8:56 pm    Post subject: Reply with quote

lurc wrote:
₂ <-- that?

its unicode byte is 0x2082 (8322)

but thers no alt code for it so you'll have to copy and paste or set the charecters manually.

btw, Windows has this awesome program called Character Map.
It has most of your charecters all you have to do is look Wink


When I try to paste it into Dev-C++, it comes up as v(2) and thats what it shows up as when i try to compile. Any ideas?
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun May 11, 2008 9:01 pm    Post subject: Reply with quote

Switch to Visual Studio 2008 or Visual C++ Express 2008
I don't believe Dev-C++ uses UNICODE.

_________________
Back to top
View user's profile Send private message
Blazin
Grandmaster Cheater
Reputation: 0

Joined: 17 Sep 2006
Posts: 770
Location: Somewhere over the rainbow.

PostPosted: Sun May 11, 2008 9:22 pm    Post subject: Reply with quote

lurc wrote:
Switch to Visual Studio 2008 or Visual C++ Express 2008
I don't believe Dev-C++ uses UNICODE.



Edit: I'm going to use the switch command and make it multiple choice or something instead. However, I still want to learn what was wrong with my earlier code.


Ok, thanks for the advice. I will when I have some more time, but for now i need to finish a project for science thats due tomorrow lmao. I'm trying to compile this, and it works, but the if {} else {} thing isn't working for me. It keeps telling me correct, even if the coefficient is wrong.
Code:
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
   cout <<"Lets start with Synthesis reactions, I'll solve and then you will"
   <<" balance it.\n\n"
   <<"**NOTE**: You cannot make a subscript or superscript show up"
   <<" in C++,\nlet alone command prompt. Therefore I will be using single"
   <<" numbers in\nparenthesis as subscripts. "
   <<"\n\nLets do Lithium + Oxygen. Li + O --> Li(2)O\n";
   char nLiCo;
   int nLi2 = 2;
   cout << "What coefficient would go in front of Li on the reactant side?\n"
   <<"If none, type none.";
   cin >> nLiCo;
   if ( nLiCo = 2)
   {
        cout <<"Correct!"
        << endl;
   }
   else
   {
       cout <<"Wrong!"
       << endl;
   }
system("PAUSE");
return 0;
}


Edit: I'm going to use the switch command and make it multiple choice or something instead. However, I still want to learn what was wrong with my earlier code.
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Mon May 12, 2008 8:00 am    Post subject: Reply with quote

your using an assignment operator in your if statement, not a conditional comparison.

= : Assignment
== : Equal

Code:
if ( nLiCo == 2 )
{
}
else
{
}


if you swich to VS2008/VC2008 Then you could do std::wcout or even better just use _tprintf and use UNICODE charecters so you could do

wcout:
Code:
std::wcout << _T("Subscript 2: ") << (TCHAR)0x2082;


_tprintf:
Code:
_tprintf(_T("%c"),0x2082);


Note:
1. Include tchar.h
2. _T( ) is a macro for UNICODE

_________________
Back to top
View user's profile Send private message
Blazin
Grandmaster Cheater
Reputation: 0

Joined: 17 Sep 2006
Posts: 770
Location: Somewhere over the rainbow.

PostPosted: Mon May 12, 2008 1:47 pm    Post subject: Reply with quote

Thanks a LOT!
+Rep, wonderful help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites