-
Posts
163 -
Joined
-
Last visited
Avratz's Achievements
-
The issue is that you are using cin << for input which is tokenized by spaces. Even if I enter "oshi no ko" it will only read "oshi" as my input (trying echoing your input with cout). The comparison will fail regardless if you use the overloaded == operator or strcmp. You need buffered input https://en.cppreference.com/w/cpp/string/basic_string/getline Pro-tip: don't ever use 'using namespace std'. Just get used to typing std:: #include <iostream> #include <string> int main() { std::string name, anime, yn; std::cout << "Enter your name:" << std::endl; std::getline(std::cin, name); //std::cin >> name; std::cout << name << " is a nice name" << std::endl; std::cout<< "Do you have watched any animes? Reply in yes & No" << std::endl; std::getline(std::cin, yn); //std::cin >> yn; //try commenting out the std::getline and uncommenting the std::cin lines above //and see what happens. //After that uncomment the two lines below and try again //std::cin.clear(); //std::cin.ignore(INT_MAX, '\n'); if (yn=="yes") { std::cout << "Which was your favourite?"; std::getline(std::cin, anime); //when in doubt, echo your input //std::cout << anime << std::endl; if (anime=="oshi no ko") { std::cout << "Thats great!" << std::endl; } if(anime=="hi") { std::cout << "Good evening." << std::endl; } } return 0; }
-
Output impedance will only be a factor when considering tube amps. Digital amps are generally in the <1ohm range. For example, I own a Schiit Vali. At 6.5ohms it's too noisy for my 38ohm ATH-M50s, but sounds fantastic with my 250ohm DT-990s. According to the Asus site, your onboard sound uses a Texas Instruments LM4562 op-amp. Rated at 0.01ohms output impedance, and can drive 600ohm headphones. You don't need anything else, really. Get the cheaper DT-990s. It's plastic vs metal frame, otherwise identical.
-
HGST Deskstar NAS. 3TB drives are ~$130 http://arstechnica.com/information-technology/2015/01/hard-disk-reliability-examined-once-more-hgst-rules-seagate-is-alarming/
-
Best Way to calculate light - the most 'good looking' and unlaggy way?
Avratz replied to Zambonie's topic in Programming
http://www.redblobgames.com/articles/visibility/ -
http://www.cplusplus.com/reference/cstring/strcmp/ You need to use strcmp() to compare strings. Also, when using %s in scanf you should limit it to your buffer size with %Xs where X is your buffer size minus 1. Buffer overflows will cause you headaches. Since your buffer size is 10 you would write: scanf("%9s", lcTipoVehiculo);
-
I've had to use it the past 4 months at work porting our software to Chrome Native Client. Its integrated GDB debugging is about the only real redeeming quality for C++ coding. It's serviceable once you spend some time setting it up. That is, turning it into a fancy text editor with integrated debugging. CLion might overtake it, but as it stands there aren't a lot of worthwhile options for C++ IDEs in Linux.
-
Start here? http://www.mm2x.com/
-
Take address1 out of quotes in your fopen_s call. You're trying to open a file called "address1", not what you entered. fopen_s(&file_in, address1, "r");
-
Escaping is only needed for string literals. User input doesn't need to. In your original example, you had the file paths hardcoded, and thus needed to escape them. The *_s functions are done that way, so the function can return a meaningful error value. It's safer in the sense that you are handed the error code directly rather than relying on a global error flag. See the section on return values here http://msdn.microsoft.com/en-us/library/z5hh6ee9.aspx For standard fopen you have to make a call to perror() or check the value of errno to get more information on the error. A NULL file handle isn't very meaningful beyond the fact it failed. Sometimes it's useful to know why. ex Microsoft version
-
You need to properly escape your slashes \\\\psf\\Home..
-
What? As someone who prefers heavy switches, I'd look for a board with blacks or clears for something quiet. I don't mind clicky, so I quite enjoy my QFR with greens. I just built a board using tactile greys which I would recommend except I'm not aware of anyone that actually sells a keyboard with them.
-
Golfing is fun. I should have prefaced my post with just because you can doesn't mean you always should. Conditional expressions are useful. Just don't abuse them like I did. I'd rather write printf("some message ... %s\n", str ? str : "<<null str>>"); than an if block though.
-
intmain(void){ int arr[63] = { 1,2,3,4,5,6,7, 8,9,10,11,12,13,14, 15,16,17,18,19,20,21, 22,23,24,25,26,27,28, 29,30,31,32,33,34,35, 36,37,38,39,40,41,42, 43,44,45,46,47,48,49, 50,51,52,53,54,55,56, 57,58,59,60,61,62,63 } ; int x = 0; for(; x < 63; x++) printf((x+1)%7?"\t%d":"\t%d\n",(arr+x/7*7)[x/7&1?6-x%7:x%7]); return 0;} I'd buy a book. http://www.amazon.com/Programming-3rd-Stephen-G-Kochan/dp/0672326663/ref=sr_1_8?s=books&ie=UTF8&qid=1415929027&sr=1-8&keywords=c+programming
-
It's committing undefined behavior. Don't do it. It's perpetuated by new, unaware programmers, and bad advice.
