Jump to content

fizzlesticks

Member
  • Posts

    1,196
  • Joined

Everything posted by fizzlesticks

  1. I just followed the quick start section on the github page then googled if I couldn't figure something out. There is no linking to VS, the program edits some internal VS files to make things available in any project (if you did the integrate step in the guide.) vcpkg install sdl2 curl installs the 32bit dynamically linked versions of the libraries so make sure your project is set to x86 if you want to get the 64 bit version use vcpkg install sdl2:x64-windows and for statically linked (if the library supports it, I don't know if sdl or curl do) vcpkg install sdl2:x86-windows-static for 32bit or vcpkg install sdl2:x64-windows-static for 64bit After installing you should be able to just #include <SDL2/sdl.h> and everything should work automatically.
  2. For using 3rd party libraries like SDL in Visual Studio you can use VCPKG. You tell it which version of the library to install (32 or 64 bit, static or dynamically linked) and it will automatically download, build and add the proper compiler and linker options for you to use the libraries in your projects. Not every library will be available but a ton are.
  3. Visual Studio's compiler doesn't support standard C and it never will. If you want to write straight C code you shouldn't be using VS.
  4. Nope, I just used the docs when I was messing around with it.
  5. This is a problem with the SDL library. SDL defines its own entry point so must either tell VS where that entry point is by setting the subsystem to console then in project properties > linker > advanced, setting the entry point to whatever SDL calls its main function (I can't remember the name sorry.) Or add a define for SDL_MAIN_HANDLED before #including SDL.h to tell SDL you want to use your own entry point.
  6. The algorithm you're looking for is called "rotate", unfortunately Python doesn't have a built in function for it but it should be easy to implement after a quick google.
  7. http://en.cppreference.com/w/c/string/byte/strtol probably, but I'm not really into C so someone else might know better.
  8. int limit = (int)argv[1]; argv is an array of "strings", you can't just use a cast to get the int value.
  9. The requests library has a built in JSON thingy. a=requests.get(url) print(a.json())
  10. for (int i = 0; i < studentStringNames.Length || found; i++) { if (nameSearchingFor.Equals(studentStringNames[i])) //This is the line where the error is showing up. { found = true; OutputBox.Text = studentNumberGrades[i].ToString(); } else { OutputBox.Text = "Student Not Found."; } } If the name you're searching for is in the list you set found to true which makes the condition of the for loop i < studentStringNames.Length || true which is always true, giving you an infinite loop.
  11. Please post the code as text, not a screen shot. It makes it much easier to help.
  12. If going the .upper() or .lower() route, you should use .casefold() instead. It converts to lowercase but works better for certain unicode characters.
  13. Advent of Code A new programming challenge every day from now until Christmas.
  14. Find out what language your school uses for their beginner classes and start learning that.
  15. Is your Python installed in a directory that has a space anywhere in the path?
  16. Using "std::cin >> " will only read up to the first whitespace character. To read an entire line you should use std::getline(cin, string) which will by default read up to a newline character but you can also set whatever delimiter you want.
  17. You convert argv[2] to an int using atoi then compare them.
  18. argv[2] is a char* and you're trying to compare it to an int, that doesn't work.
  19. printf("%f", &numberTwo); You're passing the address of the float, not the float. Get rid of the &. Same goes for all the other printfs you have.
  20. The first one just returns a function object, the second one actually calls that function object. But since you don't use the arguments at all you should just do strat_map = { '1': lambda: print('One'), '2': lambda: print('Two') } strat_map['1']() strat_map['2']()
  21. Yup tried that. Are you able to reproduce the bug by just calling that 1 function with a hardcoded string?
  22. Most people don't like downloading random files posted online. Go ahead and do that, I tried the function you posted and it seems to work fine for me both while debugging and not.
  23. Please copy/paste the code into your post using code tags.
  24. That will gives the last element, not the last valid character in the array. And to answer OP, use a string not an array.
×