Top posting users this month | |
Latest topics | » Where to go from here.September 14th 2020, 1:20 pm by MrNicNac» Send me an EmailSeptember 14th 2020, 1:16 pm by MrNicNac» [v1.6.0.0] Lua Script Obfuscator [No Bytecode]July 6th 2015, 7:38 pm by m27frogy» New Site PossiblyJuly 6th 2015, 4:16 pm by m27frogy» Ambassador!April 15th 2015, 11:40 pm by naknak» Boop - TagApril 13th 2015, 9:46 pm by naknak» Vip Class ScriptApril 13th 2015, 4:54 pm by naknak» Who's active?!April 13th 2015, 4:52 pm by naknak» Genesis PointJuly 17th 2014, 7:04 pm by branefreez» Reward SystemJuly 17th 2014, 5:41 am by m27frogy» Script RequestJuly 10th 2014, 11:43 am by naknak» local scripts?July 10th 2014, 11:39 am by naknak» Project: Reconstruction [Died]July 10th 2014, 11:36 am by naknak» Hi. I am new hereApril 26th 2014, 4:01 pm by altshiftkey» What's your favorite sport?January 1st 2014, 2:13 pm by m27frogy» FlashLight ScriptJanuary 1st 2014, 2:11 pm by m27frogy» Gun Making! [READ DESC]January 1st 2014, 2:10 pm by m27frogy» Hi, I am new here!November 26th 2013, 3:33 pm by Keanu73» Improve CodingOctober 26th 2013, 1:12 pm by pook03» Simple ButtonSeptember 1st 2013, 6:19 pm by branefreez |
|
| C++ script | |
|
+4blueymaddog naknak Supernapalm ninga95 8 posters | Author | Message |
---|
ninga95 Administrator
Posts : 122 Join date : 2010-07-30 Age : 29
| Subject: C++ script February 22nd 2011, 10:34 pm | |
| Look at this - Code:
-
#include <iostream> #include <cmath> int main () { using namespace std;
double num1; cout << "Pick your number.." << endl; cin >> num1; double num2; num2 = sqrt(num1); cout << "The sqaure root of " << num1 << " is " << num2 << endl; system("pause"); return 0; } What this does is brings up a output and says "Pick your number" Then you insert a number and i mean any number, press enter, and it tells you the square root of that number EPIC. | |
| | | Guest Guest
| Subject: Re: C++ script February 22nd 2011, 10:55 pm | |
| Okay?
Is cmath a standard C++ library? I'm learning from a book I got, and it hasn't mentioned the libraries yet, though I haven't read too far into it yet :/
(laziness ftw :P) |
| | | ninga95 Administrator
Posts : 122 Join date : 2010-07-30 Age : 29
| Subject: Re: C++ script February 22nd 2011, 11:03 pm | |
| Correct cmath is a library, and when you use it like that you can use any built in math function C++ provides | |
| | | Supernapalm Expert Scripter
Posts : 393 Join date : 2011-01-17
| Subject: Re: C++ script February 25th 2011, 11:13 pm | |
| im about to get a book of C | |
| | | naknak Administrator
Posts : 878 Join date : 2010-07-30
| Subject: Re: C++ script February 25th 2011, 11:39 pm | |
| I doubt you would necessarily need C or C++. The only good thing about them is they take nearly no system resources compared to others, but they take a lot longer to write. C or C++ should only be used if you actually need those spare resources, which in most cases you don't. Well, you won't need it unless you hack often... | |
| | | ninga95 Administrator
Posts : 122 Join date : 2010-07-30 Age : 29
| Subject: Re: C++ script February 26th 2011, 2:09 am | |
| No C++ can be used to make files, 3D games, or even 2D games, but we don't need it for a site. What we need is PHP, HTML, XML, and CSS. | |
| | | blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: C++ script March 8th 2011, 7:00 am | |
| I feel like making my own math functions. I haven't made functions in C++ yet so syntax will probably be completely wrong:
public static decimal sqrt(int number) return decimal number^0.5;
:\ any good?
| |
| | | ninga95 Administrator
Posts : 122 Join date : 2010-07-30 Age : 29
| Subject: Re: C++ script April 23rd 2011, 12:24 pm | |
| - ninga95 wrote:
- Look at this
- Code:
-
#include <iostream> #include <cmath> int main () { double num1; std::cout << "Pick your number.." << std::endl; cin >> num1; double num2; num2 = sqrt(num1); std::cout << "The sqaure root of " << num1 << " is " << num2 << std::endl; getch(); return 0; } What this does is brings up a output and says "Pick your number" Then you insert a number and i mean any number, press enter, and it tells you the square root of that number EPIC.
Last edited by ninga95 on April 23rd 2011, 12:26 pm; edited 1 time in total | |
| | | ninga95 Administrator
Posts : 122 Join date : 2010-07-30 Age : 29
| Subject: Re: C++ script April 23rd 2011, 12:26 pm | |
| I edited it. :} And accidentally pressed quote | |
| | | Guest Guest
| Subject: Re: C++ script August 6th 2011, 1:15 am | |
| - blueymaddog wrote:
- I feel like making my own math functions. I haven't made functions in C++ yet so syntax will probably be completely wrong:
public static decimal sqrt(int number) return decimal number^0.5;
:\ any good?
Not quite. You don't need public static because it's not a member of any class. Also, decimal would be double. The only problem is that you'd have to - Code:
-
#include <cmath> to get the pow function. cmath also has the sqrt function built in, so making your own would be redundant. in C++, the ^ operator is used on a bitwise level, and represents XOR. I've seen an inverse sqrt done on a bitwise level, which is, I think, the only way to make it without redundancy. |
| | | slayer9365 Expert Scripter
Posts : 233 Join date : 2010-07-31 Age : 29
| Subject: Re: C++ script August 6th 2011, 1:15 am | |
| The member 'pwnedu46' has done the following action : Dice Roll
'Test' : 4 | |
| | | m27frogy The Garbageman
Posts : 336 Join date : 2011-06-23
| Subject: Re: C++ script August 13th 2011, 1:10 pm | |
| - Quote :
- No C++ can be used to make files, 3D games, or even 2D games, but we don't need it for a site. What we need is PHP, HTML, XML, and CSS.
Did you forget to mention XHTML? That's my favorite. | |
| | | myrco919 Intermediate Scripter
Posts : 190 Join date : 2011-01-21 Age : 26 Location : Holland
| Subject: Re: C++ script October 20th 2011, 7:34 pm | |
| - m27frogy wrote:
-
- Quote :
- No C++ can be used to make files, 3D games, or even 2D games, but we don't need it for a site. What we need is PHP, HTML, XML, and CSS.
Did you forget to mention XHTML? That's my favorite. It's unusualy, but sometimes C++ IS used for websites. | |
| | | IsAPotato Novice Scripter
Posts : 16 Join date : 2011-06-04 Location : California
| Subject: Re: C++ script December 11th 2011, 12:28 pm | |
| I <3 Javascript. /sarcasm | |
| | | blueymaddog Administrator
Posts : 1081 Join date : 2010-12-09 Age : 26
| Subject: Re: C++ script February 4th 2012, 7:03 am | |
| - pwnedu46 wrote:
- blueymaddog wrote:
- I feel like making my own math functions. I haven't made functions in C++ yet so syntax will probably be completely wrong:
public static decimal sqrt(int number) return decimal number^0.5;
:\ any good?
Not quite. You don't need public static because it's not a member of any class. Also, decimal would be double.
The only problem is that you'd have to - Code:
-
#include <cmath> to get the pow function. cmath also has the sqrt function built in, so making your own would be redundant. in C++, the ^ operator is used on a bitwise level, and represents XOR. I've seen an inverse sqrt done on a bitwise level, which is, I think, the only way to make it without redundancy.
Oh, I'm so used to C# that I added public static to it... | |
| | | Sponsored content
| Subject: Re: C++ script | |
| |
| | | | C++ script | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| Who is online? | In total there are 29 users online :: 0 Registered, 0 Hidden and 29 Guests
None
Most users ever online was 136 on October 21st 2024, 12:16 pm
|
| Please tell us what time zone you are in here
Got a really good idea? Post it in projects and it might show up here! |
|