-
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);
-
A pointer can be passed either by value or by reference by value void foo(int* bar); by reference void foo(int* & bar); Arrays generally decay to a pointer, but not always.
-
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.
-
Sparts
- 22 replies
-
- cpu
- performance
-
(and 8 more)
Tagged with:
-
That bad boy would speed up my compile times nicely. And, of course, gaming, running virtual machines, video editing. Sometimes all at the same time.
-
Start here? http://www.mm2x.com/
-
Screw a funnel. I'd just siphon it from the big jug of oil
- 96 replies
-
- mineral oil
- pc
-
(and 8 more)
Tagged with:
-
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