Jump to content

Markup

Members
  • Posts

    612
  • Joined

  • Last visited

Everything posted by Markup

  1. http://www.youtube.com/watch?v=zi_jNV9K9zo (I land the same jump that causes me to die if you stopped watching) Work in progress. Jumpbug is where you can land a > 500u/s fall velocity without taking damage by releasing duck and pressing jump within 2 units of the ground. This was done on a localhost server so theres no ping prediction or u/frame interval prediction.
  2. Out of curiosity, why have you gone with a left-handed holding of the gun rather than right-handed? It feels out of the way, hard to describe.
  3. A project of mine http://www.youtube.com/watch?v=_wJoLW7L1Bc (youtube embeds not working?) http://
  4. As for std::getline(std::cin, people[x].setName(std::string)); The actual error is that it expected an identifier (name) for the type std::string eg: std::getline(std::cin, people[x].setName(std::string lol)); But it wouldn't have worked anyway. Wrong I think. See <string>'s @ http://www.cplusplus.com/reference/string/getline/ The 2nd parameter should be a "string object". You could modify getName to return the string object but this requires pointers which you'll learn about later on. With a modified getName you could then do: std::getline(std::cin, *(people[x].getName())); Anyway, you could fix this with something like: std::string line; std::getline(std::cin, line); people[x].setName(line); You should follow cplusplus.com, don't jump ahead, always go backwards. Theres many different solutions to a given problem in programming, to me, it's about finding the most efficient solution.
  5. May aswell start with your constructor. Dbs::Dbs() { std::vector<Dbs> people (1, Dbs()); } First of all, people is initialized as a local variable because it is within the scope of a function, this is why you are getting "undeclared identifier". Should also point out that: the constructor Dbs() creates a std::vector of type class Dbs, and constructs another Dbs() object which is added to the std::vector. Then this newly constructed Dbs() creates a std::vector of type class Dbs, and constructs another Dbs() object which is added to the std::vector. Then this newly constructed Dbs()... :D You get the point. Let's start some code: Let's start with making the class that will store our data per entry. Note that ID is under public(just the way this was designed(not the best way!)). We have declared more than one constructor, a default constructor and a custom one. class Entry { private: int age; int zip; std::string name; std::string address; std::string city; std::string state; public: int ID; Entry(); Entry(int _age, int _zip, std::string _name, std::string _address, std::string _city, std::string _state); void setAge(int _age) {age = _age;}; void setZip(int _zip) {zip = _zip;}; void setName(std::string _name) {name = _name;}; void setAddress(std::string _address){address = _address;}; void setCity(std::string _city) {city = _city;}; void setState(std::string _state) {state = _state;}; int getAge() {return age;} int getZip() {return zip;} std::string getName() {return name;}; std::string getAddress() {return address;}; std::string getCity() {return city;}; std::string getState() {return state;}; }; Entry::Entry() { } Since we have declared our custom constructor we need to define it. This constructor allows us to initialized all variables in the entry without calling every setFunction. Entry::Entry(int _age, int _zip, std::string _name, std::string _address, std::string _city, std::string _state) { age = _age; zip = _zip; name = _name; address = _address; city = _city; state = _state; } Now let's create a class to represent our database. uID means unique ID (Im guessing this is what you intended your original "num" to be). We have a std::vector to store our entries in, a constructor and a function to addEntry. class Database { private: int uID; std::vector<Entry> tableEntries; public: Database(); void addEntry(Entry e); }; We must initialized uID before we use it, so we change the default constructor. Database::Database() { uID = 0; } Define our addEntry function. We are passing a class object of type Entry to addEntry. Use uID to give the entry a unique id. Add the entry to the std::vector. Increment uID for use next time. void Database::addEntry(Entry e) { e.ID = uID; tableEntries.push_back(e); uID++; } Let's give it a go. First initialized a class object of Database. Then were going to want to add an entry, so initialized a class object of Entry. Fill it in. Use our Database's class addEntry to add the entry to the database. The second addEntry uses our custom constructor to make things easier. int main() { Database db; Entry test; test.setAge(12); test.setZip(1337); test.setName("Mark"); test.setAddress("a"); test.setCity("b"); test.setState("c"); db.addEntry(test); db.addEntry(Entry(12, 1337, "using constructor", "a", "b", "c")); } All in one: http://pastebin.com/QdUJjaPj These are the basics, try implementing your other stuff.
  6. Relevant info: Solution: From the long answer you gave, it is clear that the file you created was not added to the project, you created a completely seperate file. This file was not linked to the project and so was not visible to the linker. To add a file to your project you need to right click the relevant folder on the left(in this case right click "source files") and create a new file from the menu there. Then add your code as normal and all should be fine. #include <iostream> int main() { std::cout << "Hello world" << std::endl; return 0; } Oh and F7 is build. To run a console application and actually see the result you can do either: locate the built [Caution: Executable File] by explorer, usually in project name/Debug/, copy the full directory path (windows vista+ right click the directory path and you can edit it as full text path, copy from there) windows key + r (or start>run) > type "cmd" press enter > type "cd " (include the space) > right click the window click paste > press enter > type the name of the [Caution: Executable File] including the extension [Caution: Executable File] > press enter This will run the program. To run it again all you have to do is press the up arrow to recall the previous command and press enter. If you wish to stop execution of the program early, press CTRL C The other way to see the output is by adding some code just before return 0 of main. #include <iostream> int main() { std::cout << "hello world" << std::endl; system("pause"); return 0; } Then all you have to do is double click the file in explorer and it pauses before it exits. system(""); gives access to the OS Shell eg open up cmd[Caution: Executable File] (windows key + r > type "cmd" press enter > type "pause" press enter).
  7. Markup

    Lag

    Can you re edit to include the original problem, such that others with the same problem can find the solution via google.
  8. Cant help you with the registry but heres the winapi version http://msdn.microsoft.com/en-us/library/windows/desktop/ms724947%28v=vs.85%29.aspx BOOL WINAPI SystemParametersInfo( __in UINT uiAction, __in UINT uiParam, __inout PVOID pvParam, __in UINT fWinIni );
  9. Me being me: http://www.youtube.com/watch?v=pctl2Wtu_io http://www.youtube.com/watch?v=xuhOHhnEP0g http://www.youtube.com/watch?v=C0vFzUBfCqI http://www.youtube.com/watch?v=5XBragaojAM
  10. Indeed. I totally lost it with the "enhancing the truth" post. Philosophical question of the day: Is it botting if GLaDOS owns a Runescape account? Let's add to this. If perfect AI was created, and that program happened to play runescape, would it be a player AND/OR a bot? Would you want AI playing a game you created? Would you mind if characters you were playing with were AI?
  11. They're probably not releasing for the PC because people will just cheat.
  12. I'm currently setting up a minecraft server. Would be happy to host if you guys are up for it. UK based host though, not sure how the game plays at 100-200 ping.
  13. http://eseanews.com/index.php?s=news&d=comments&id=9969
  14. This is true. However some of the players have roots in 1.6 and prefer 1.6, only moving to source because there was more money for them there because they could compete at a higher level.
  15. I linked the wrong section, but you get the idea. http://www.w3schools.com/jquery/jquery_selectors.asp
  16. http://www.w3schools.com/jquery/jquery_syntax.asp eg: <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready( function() { $(".btest").click( function() { $(".test").hide(); }); $(".btest2").click( function() { $(".test").show(); }); $("#btest3").click( function() { $(".test").hide(); }); $("#btest4").click( function() { $(".test").show(); }); }); </script> </head> <body> <h2 class="test">This is a heading</h2> <p class="test">This is a paragraph.</p> <p>This is another paragraph.</p> <button class="btest">hide(class)</button> <button class="btest2">show(class)</button> <button id="btest3">hide(id)</button> <button id="btest4">show(id)</button> </body> </html>
  17. Markup

    AP Exams

    How do credits effect the length of your course?
  18. For a start, the main problem is that your input line is missing a ')'. You need to use raw_input() instead of input() And you should not use IDLE for implementations, only for testing new functions / odd bits. Set up your environment variable paths, and run your code from cmd, much easier. import math # makes the math library available def main(): print("This program finds the real solutions to a quadratic") print() a,b,c = eval(raw_input("Please enter the coefficients(a,b,c): ")) discRoot=math.sqrt((b*b)-(4*a*c)) root1=(-b+discRoot)/(2*a) root2=(-b-discRoot)/(2*a) print() print("The solutions are: ",root1,root2) main()
  19. How are you drawing to screen? Is this open source?
  20. Now fixed, within the past 2 hours or so
  21. The problem is still occuring
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.