Jump to content
xisto Community

iGuest

Members
  • Content Count

    72,093
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by iGuest

  1. iGuest

    Hello

    i think it is... despite some bugs that are being fixed.(bugs on the free host only).but we hope that more one or two days and they?re solved.You can apply to the free host account and check all its web host options. I think you?ld like. :Dthats my opinion, check others.regs,
  2. For all of those who dont know you can get a decent domain for FREE just visit http://www.dot.tk/en/index.html?lang=en you can have up to 3
  3. http://forums.xisto.com/no_longer_exists/ please look at my site and tell me what you think in the poll or in a reply
  4. iGuest

    Hello

    Hi im new to FNH and im just wondering is it good hosting and do you get cPanel
  5. Once there was A big fat Lama eating a game called the 'two lama's and when he finished he dropped dead on the spot, four legs skyward, which was his least faorite thing in the world but he wanted to experience the pain of dying like a horse using an enema from the space
  6. thanks, I'll be adding a shoutbox etc.. later on
  7. You will need passion, devotion and even obsession to really appreciate C++ Programming. Lets grab a compiler If you have a C++ Compiler then you are all set for turning your C++ code into executable files, if you do not then I recommend getting dev-c++. To learn more about that compiler I recommend browsing their site. First Program - number.cpp So now I'm going to write up our first program to learn from, which shows how we can display text to the screen. I know it's probably a bit simple, so maybe I'll spruce it up a bit, as no matter how complex a code can get, the best way to learn is explaining it, so why start off with a simple hello, world when more things can be introduced and explained? Lets see what I do: //---------------------------------------------------------------------- // Name: number.cpp // Description: checks number is greater than or less than zero //---------------------------------------------------------------------- #include <iostream> using namespace std; int main() { int number; // defines a variable to store an integer cout << "Enter a non-zero integer: "; cin >> number; while(number != 0) { if(number > 0) { cout << "That integer is greater than zero." << endl; } // end if statement else { cout << "That integer is less than zero." << endl; } // end else statement cout << "Enter a non-zero integer: "; cin >> number; } // end while loop cout << "You entered zero." << endl; return 0; } // end main function I would like to point out that this program has it's flaws. With any code, if we are getting users to input data, we have to check that data and make sure that it's the correct type allowed, if not then our programs may not function how we intended it to be. We will however fix it up, later on. This program is console based, meaning it's a dos-like program. It's best if ran from the command prompt. Save this program as number.cpp, compile it then open up a command prompt browse to where you compiled the executable and run it. Enter 0 (numeric zero) to exit. This program demonstrates outputting strings to screen, simple data types, getting user input, while loops, if-else statements and more. Read on to find out what it all does. So to explain this program we will begin at the very first section. Comments //----------------------------------------------------------------------// Name: number.cpp// Description: checks number is greater than or less than zero//---------------------------------------------------------------------- First of all you need to understand that anything after two forward slashes // comments out the entire line after it, this is the C++ style of comments, you can still use the old C-style of commenting, anything enclosed between /* and ended with */ will be commented. The only noticable problem with the C-Style way is that the compiler must check everything after /* looking for the ending */ before continuing, the C++ style comment says that anything after the // can be ignored so it moves onto the next line without searching for an ending. What I've done in this commented section is I am telling people who read this source the name of this file and a brief summary of what it's suppose to do. It's a good idea to use comments within your code to explain sections of the code. Comments are not compiled into a program, it's only their for the viewers benefit. // This is the C++ style comment/* This is the C-Style comment,and can span multiple lines */ #include <iostream> This is our #include preprocessor directive, this inserts the header file iostream into the code at this point. Header files contains many functions and objects, including the cout and cin objects which we will be using later on in our program. We need to declare such headers for these functions and objects in C++ so that our program knows how to use them when it encounters them. Here are the allowed preproccessing directives in standard C++: #define - Defines a token#elif - The else-if directive#else - The else directive#error - Current error#if - The if directive#ifdef - The if-defined directive#ifndef - The if-not-defined directive#include - Includes a file#line - Current line#pragma - Special function run before the rest of the code#undef - Undefine Preprocessor directives are handled before the C++ compilation process starts. Any code that uses cout or cin must include the iostream header. Header files included in the C++ library were created by others to eliminate recreating the wheel, when it came to writing code. These standard sets of commands were included in the standard template Library (STL). using namespace std; This line is added because we're using the new C++ style header file iostream, the names in iostream are part of the namespace std, which stands for standard. The main reason we are using this is to save us from writing: std::cout << "This is a string" << std::endl; Technically you're suppose to prefix certain objects with std::, but by making std the default namespace as we have done, it is assumed that those objects will be using std. This isn't the complete reason for why we're using this, but it is the reason for this program, other reasons would be to avoid conflicts between the names we use in a program and the names other programmers may have used. If you use the same names in different namespaces, there is no conflict. So for example, a function (a set of instructions to be performed, we'll learn more about this later on) written by someone else can't overwrite yours by mistake. int main() {...insert code here } This starts our main function. The main function is the point where control is passed to your program from the operating system. What does that mean? This is where you place the code you want executed first. All C++ programs require a main function, with only a few exceptions but we will not get into those yet. The structure of int main() is followed by curly braces { } enclosing the code that forms the body of the function and that is executed when the function is called. The int keyword in front of main indictates that this function main will return an integer value to the Operating System. This is how functions work, the code in them is run when the function is called. main is called the program's entry point. Important tip for what's about to come To end a simple statement in C++ we must use a semi-colon ; This character pretty much acts like a period at the end of a sentence, while the statements act like the sentences. There's also compound statements, code that would usually be enclosed in curly braces { }, if this is the case, then you should not use a semi-colon at the end of it, examples of compound statements would be creating functions using the function keyword, any of the loop statements and if-else statements. int number; int is one of the builtin types. It's called a simple type, after you declare a variable of a simple type, C++ sets aside space for it in memory and you can use it in your program. int is our basic integer type which declares we will be using whole numbers, positive or negative. After int we have the variable name number, this is the name we refer to in our program, look at it as a placeholder for an integer, number is our declared integer variable, it has been set aside space in our memory and we can use it to store an integer and be able to do all sorts of things to it. We did not have to call it number though, we could have given it any name we wanted to, the better the name helps you understand what it's for the better it is for you. Examples: int number; // declares a variable to store integerint anotherNumber = 486; // declares a variable and initialises the number 486;int a, b, c; // declares multiple integer variables at once. TIP: When explaining variables, e.g. int number = 500; We should describe it as: 'number' is a container that reserves enough space in memory to store an integer value, we refer to this integer value by using it's given name 'number'. 'number' has been assigned using the assignment operator to store the value '500' inside it. If you can imagine a box, that has been given a name, the size of the box is determined by what the box is specifically suppose to hold by telling it what items it can hold (data types). Data types do two things for this, size it can hold and type of data it can take. cout << "Enter a non-zero integer: "; We display "Enter a non-zero integer: " message using the iostream object named cout. This object cout, handles the text-based output we want to display from a program. We use the << operator here to send the text "Enter a non-zero integer: " to cout. You use operators to perform work on data values called operands. e.g. 4 + 9 uses the plus (+) operator to add the operands 4 and 9. cout is a special stream object in C++ that can handle many of the details for you. You can pass text or numbers to cout and it'll be able to handle both by itself. cout << "Hello, World!"; // prints Hello, World! to stdout (the screen)cout << number; // prints what is stored in the variable name number cin >> number; cin is used for reading text-based input from stdin, most commonly the keyboard, this object is what grabs user input and stores it in the variable we declared earlier on, in this case our integer number, cin will not return any value until the user presses ENTER, it will only grab the first set of characters up until it reaches a whitespace. whitespace is anything from tab, space, NULL characters. If we tried to input "686 123" and then output it, we would only get 686, the rest would not show, this is because cin encountered a space in the string and therefore did not continue to the end of it. We can grab multiword lines of text but that will be explained in a later time. So the above simple statement waits for user input, when ENTER is received it stores that input in the variable we declared. NOTE: What if our user does not input the expected data type? Say our user accidently inputs letters instead of the expected integer/number, then we will have problems and our program may not function how it is suppose to be. That is why at the end of this, I will show you how we can correct this, so that our program will terminate automatically so that it can not malfunction. If you do attempt to try the program without a fix, then you may need to know how to force a break in your program. CTRL + C is your friend. Notice that the operator >> for cin is pointing opposite direction to the operator used for cout, <<. This is something you will need to remember, once you get comfortable at knowing which operators to use with these objects, you will not have any problems with them. Try and find a way that will help you, maybe think of the way they point or the what the mouth of them are opened at. Just make sure you have them the right way round, your compiler will let you know if you've got them around the wrong way. while(number != 0) { ... execute statements in here } A while loop keeps executing the statement in it's body as long as this particular condition is true. In our case the condition is (number != 0) which means. while our variable number is not equal to zero. So if our user entered a number when we asked for it using cin that was not zero, this condition would evaluate to true and whatever is in the curly braces would be executed. Until this condition is false would we ever leave this loop or if for some reason we force the loop to exit prematurely. So how would we make this condition false, easy, if we entered the number zero, the condition would be if zero is not equal to zero execute the loop, but since zero does infact equal zero, then this condition is false and the loop will not execute, not even once, it will then proceed from the end of the loops last curly braces. We really need to know more about these Logical and Relational Operators we use in conditions, so I'll explain what they are. Relational Operators Less than < Greater than > Less than or Equal to <= Greater than or Equal to >= Equal to == Not Equal to != Logical Operators Logical And && Logical Or || About Relational Operators Relational Operators are used to create expressions that evaluate to either true or false, and these expressions are used in conditional statements like the if statement or as a test expression in a loop statement. The test expression in this case is the while(number != 0), while will continue looping through the code of the curly braces until it's condition is false. The expression that evaluates to either true or false is number. If you wanted to loop infinitely, we could do: while(true) { ...execute this code;... } There's some reasons to why you would use this infinite loop, but at this stage it's best to only use it if you understand what you're doing, as a infinite loop if used incorrectly can give you problems. So if our expression evaluates to anything other than zero then while will evaluate to true and proceed with the code again, then loop back to evaluate the condition again. If number resulted in some form of error, maybe inputting something other than a number or going outside the bounds of an integer, you'll cause an infinite loop as a result of this. This is why you require data checking. Still to be continued... sorry for being slow, balancing many things on a plate at the moment, nearly dropped the saucer. Cheers, MC
  8. No no, it's Rune Halls of Valhalla. It's made by Epic Games and HumanHead Studios and God Games. http://rune-world.com/ Rune is made with Unreal technology, so you should know what I mean.
  9. ...catching fishes with a hook dressed with feathers, thread and other materials. Here, in Argentina, we have one of the best places to fish for trout and salmon with a fly. Also we can fish for Dorado, a very fierce fish of the Ibera Marshes. Very beautifull places. Please anything else just ask.Excuse my poor english.Regards from Argentina!Mat?as
  10. I can give advice...for free off course!!!Regards from Argentina.Mat?as
  11. iGuest

    Europe

    Got my vote on Portugal there... Lovely sites, full of history and the BEST food in the world... ...but probably I'm also just a bit biased! But really, a great place to come!
  12. Its a nice piece of art... BTW why npsfqqa has to end most of his posts with the word bye..........
  13. iGuest

    Trojan

    THree weeks ago, I got 7 trojans, I had to re-install the OS.... it was such a headache....
  14. Once there was A big fat Lama eating a game called the 'two lama's and when he finished he dropped dead on the spot, four legs skyward, which was his least faorite thing in the world but he wanted to experience the pain of dying like a horse using an enema
  15. More Online Games http://www.newgrounds.com/
  16. Copied from http://forums.xisto.com/no_longer_exists/ MC
  17. If you have PC ... look after Gta San Andreas ;]Fifa, NBA, NHL 2006 (i will be for sure ;])S.T.A.L.K.L.E.R. <- heared about that many complements ;]
  18. Copied from http://www.cprogramming.com/tutorial/lesson1.html MC
  19. codezwiz is the place i got that theme i was using at the time. I'm using php-nuke platinum now like your self so the site totally different. Heres the link to codezwiz. http://codezwiz.com
  20. it would be so much simpler if it were
  21. psp is paint shop pro, from jasc software
  22. Judge not, and ye shall not be judged: condemn not, and ye shall not be condemned, forgive, and ye shall be forgiven. Luke I hate religion the bible is written in riddles If i had i time machine i go back in time and beat jesus with a baseball bat, ("why not" he should be used to it lol) I agree with mortalmatt, that comment you made up above djbungle was really uncalled for. What dose that have to do with the topic of this thread anyway.
  23. https://fr.ogame.gameforge.com/ or https://de.ogame.gameforge.com/ It's a good online game in space For senseless228 I played Counter-Strike but I have stoppen, I prefer Battlefield Vietnam
  24. i don?t need to tell you what i can do :Dif you need help , give me a call,i?m always here.Send a PMregs,Nuno
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.