A Roblox Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

A Roblox Community

A community of Robloxians who want to learn to script and build on Roblox Studio.
 
HomeLatest imagesRegisterLog in
If you're a experienced coder make some tutorials! It would really help the site grow.
Make sure you read the rules(Which can be found by clicking here)
If you're a beginner at coding, try some tutorials.
We have many Moderators/Admins watching this site. Contact them with Questions.
Let us know what your favorite sport is. By clicking here to vote (Click here)
This site is becoming inactive. Lets make it active.
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Top posters
blueymaddog
C++ script Vote_lcapC++ script Voting_barC++ script Vote_rcap 
naknak
C++ script Vote_lcapC++ script Voting_barC++ script Vote_rcap 
Supernapalm
C++ script Vote_lcapC++ script Voting_barC++ script Vote_rcap 
m27frogy
C++ script Vote_lcapC++ script Voting_barC++ script Vote_rcap 
slayer9365
C++ script Vote_lcapC++ script Voting_barC++ script Vote_rcap 
myrco919
C++ script Vote_lcapC++ script Voting_barC++ script Vote_rcap 
branefreez
C++ script Vote_lcapC++ script Voting_barC++ script Vote_rcap 
ninga95
C++ script Vote_lcapC++ script Voting_barC++ script Vote_rcap 
CloneTrooper787
C++ script Vote_lcapC++ script Voting_barC++ script Vote_rcap 
raboy117
C++ script Vote_lcapC++ script Voting_barC++ script Vote_rcap 
Top posting users this month
No user
Latest topics
» Where to go from here.
C++ script EmptySeptember 14th 2020, 1:20 pm by MrNicNac

» Send me an Email
C++ script EmptySeptember 14th 2020, 1:16 pm by MrNicNac

» [v1.6.0.0] Lua Script Obfuscator [No Bytecode]
C++ script EmptyJuly 6th 2015, 7:38 pm by m27frogy

» New Site Possibly
C++ script EmptyJuly 6th 2015, 4:16 pm by m27frogy

» Ambassador!
C++ script EmptyApril 15th 2015, 11:40 pm by naknak

» Boop - Tag
C++ script EmptyApril 13th 2015, 9:46 pm by naknak

» Vip Class Script
C++ script EmptyApril 13th 2015, 4:54 pm by naknak

» Who's active?!
C++ script EmptyApril 13th 2015, 4:52 pm by naknak

» Genesis Point
C++ script EmptyJuly 17th 2014, 7:04 pm by branefreez

» Reward System
C++ script EmptyJuly 17th 2014, 5:41 am by m27frogy

» Script Request
C++ script EmptyJuly 10th 2014, 11:43 am by naknak

» local scripts?
C++ script EmptyJuly 10th 2014, 11:39 am by naknak

» Project: Reconstruction [Died]
C++ script EmptyJuly 10th 2014, 11:36 am by naknak

» Hi. I am new here
C++ script EmptyApril 26th 2014, 4:01 pm by altshiftkey

» What's your favorite sport?
C++ script EmptyJanuary 1st 2014, 2:13 pm by m27frogy

» FlashLight Script
C++ script EmptyJanuary 1st 2014, 2:11 pm by m27frogy

» Gun Making! [READ DESC]
C++ script EmptyJanuary 1st 2014, 2:10 pm by m27frogy

» Hi, I am new here!
C++ script EmptyNovember 26th 2013, 3:33 pm by Keanu73

» Improve Coding
C++ script EmptyOctober 26th 2013, 1:12 pm by pook03

» Simple Button
C++ script EmptySeptember 1st 2013, 6:19 pm by branefreez


 

 C++ script

Go down 
+4
blueymaddog
naknak
Supernapalm
ninga95
8 posters
AuthorMessage
ninga95
Administrator
Administrator
ninga95


Posts : 122
Join date : 2010-07-30
Age : 28

C++ script Empty
PostSubject: C++ script   C++ script EmptyFebruary 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.
Back to top Go down
Guest
Guest
avatar



C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyFebruary 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)
Back to top Go down
ninga95
Administrator
Administrator
ninga95


Posts : 122
Join date : 2010-07-30
Age : 28

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyFebruary 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
Back to top Go down
Supernapalm
Expert Scripter
Expert Scripter
avatar


Posts : 393
Join date : 2011-01-17

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyFebruary 25th 2011, 11:13 pm

im about to get a book of C
Back to top Go down
http://hackthissite.org
naknak
Administrator
Administrator
naknak


Posts : 878
Join date : 2010-07-30

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyFebruary 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...
Back to top Go down
ninga95
Administrator
Administrator
ninga95


Posts : 122
Join date : 2010-07-30
Age : 28

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyFebruary 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.
Back to top Go down
blueymaddog
Administrator
Administrator
blueymaddog


Posts : 1081
Join date : 2010-12-09
Age : 25

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyMarch 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?
Back to top Go down
ninga95
Administrator
Administrator
ninga95


Posts : 122
Join date : 2010-07-30
Age : 28

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyApril 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
Back to top Go down
ninga95
Administrator
Administrator
ninga95


Posts : 122
Join date : 2010-07-30
Age : 28

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyApril 23rd 2011, 12:26 pm

I edited it. :} And accidentally pressed quote
Back to top Go down
Guest
Guest
avatar



C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyAugust 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.

Back to top Go down
slayer9365
Expert Scripter
Expert Scripter
slayer9365


Posts : 233
Join date : 2010-07-31
Age : 29

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyAugust 6th 2011, 1:15 am

The member 'pwnedu46' has done the following action : Dice Roll

'Test' : 4
Back to top Go down
m27frogy
The Garbageman
m27frogy


Posts : 336
Join date : 2011-06-23

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyAugust 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.
Back to top Go down
myrco919
Intermediate Scripter
Intermediate Scripter
myrco919


Posts : 190
Join date : 2011-01-21
Age : 25
Location : Holland

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyOctober 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.
Back to top Go down
IsAPotato
Novice Scripter
Novice Scripter
IsAPotato


Posts : 16
Join date : 2011-06-04
Location : California

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyDecember 11th 2011, 12:28 pm

I <3 Javascript. /sarcasm
Back to top Go down
blueymaddog
Administrator
Administrator
blueymaddog


Posts : 1081
Join date : 2010-12-09
Age : 25

C++ script Empty
PostSubject: Re: C++ script   C++ script EmptyFebruary 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...
Back to top Go down
Sponsored content





C++ script Empty
PostSubject: Re: C++ script   C++ script Empty

Back to top Go down
 
C++ script
Back to top 
Page 1 of 1
 Similar topics
-
» The Local Script: A Robloxian's Worst Nightmare
» Another C++ Script
» Script Help
» How Can I Improve This Script?
» Script with error somewhere .....

Permissions in this forum:You cannot reply to topics in this forum
A Roblox Community :: Questions and Help :: Scripting-
Jump to: