Segmentation Fault in C++ Program – Need Debugging Programming Software Development by YashSmith …. Here’s my code: #include <iostream> using namespace std; int main() { int arr[5]; cout << arr[10… Re: Show computer name on a label Programming Software Development by toneewa … + 1; if (GetComputerNameW(ComputerName, &cbComputerName)) { std::wcout << L"Computer Name: " …<< ComputerName << std::endl; } } } int main() { DisplayComputerName(); String^ managedString… Re: Show computer name on a label Programming Software Development by Mr.M … namespace System::Net; using namespace System::Text::RegularExpressions; using namespace std; // This I recently added as I was trying to solve… Re: Segmentation Fault in C++ Program – Need Debugging Programming Software Development by Reverend Jim Don't try to access past the end of the array. Re: Segmentation Fault in C++ Program – Need Debugging Programming Software Development by rproffitt Thanks for the MVE (minimum viable example). But it's just bad code. c, c++ and a lot of language won't stop you from going out of bounds. Re: Segmentation Fault in C++ Program – Need Debugging Programming Software Development by Dani You’re creating an array of 5 integers and then trying to access the 11th integer in the array (assuming the indexes start at 0). You’re getting an out of bounds error because you’re trying to access an array element that doesn’t exist. You can access arr[0] up through arr[4]. Re: Segmentation Fault in C++ Program – Need Debugging Programming Software Development by Salem It should be obvious by now from their posting history that the OP is a troll. std::endl vs newline Programming Software Development by Tycellent std::endl vs \n Are any particular one which should be used at specific times? I understand endl flushes the stream (although i'm not 100% what this means) while \n is simply a newline. Re: std::string question! Programming Software Development by pseudorandom21 std::string is a C++ class (or maybe a typedef'd … access operator ([b] . [/b] ). i.e., [code] std::string input; std::cin >> input; std::cout << "Size =" <…;< input.size() << std::endl; input.clear(); std::cout << "Size =" << input… Re: std::ofstream fs(string Vriable) Programming Software Development by Lucaci Andrew `std::string` are different from `C-style` strings (null terminated sequences of characters). For your example, use the `.c_str()` function from the `string` class to get the `C-style` string. std::ofstream Myfile(mystring.c_str()); [Click Here](http://www.cplusplus.com/reference/string/string/c_str/) to get more info. Re: std:: Programming Software Development by invisal … it globally [code=cplusplus] #include <iostream> using std::cout; using std::cin; int function1() { // your code here } int function2() { // your… Re: std:: Programming Software Development by JRM …, if any, between [inlinecode]cin[/inlinecode] and [inlinecode]std::cin[/inlinecode] (for example)? If the latter is better … into scope by one of these ways: using namespace std; //declare global scope (not preferred but OK for …declare only what is used in your program (prefered) OR std::cin >> helpme; //make yourself crazy and … Re: std:: Programming Software Development by JRM [QUOTE=c++ prog;523420]using namespace std; is required for u 2 be able to use cin only[/QUOTE] Not so. In my previous post I stated that you could also declare it globally with listings; using std::cin; using std::cout; this will also eliminate the need to type the prefix std:: Re: std:: Programming Software Development by carnage i did read. what i'm asking exactly is when i declared globally: using std::cin; using std::cout; the one's i'm using in statements would be plain cin and cout only or still std::cout<< std::cin>> i was just reassuring ;) well i got my answer Re: std:: Programming Software Development by Narue …include <iostream> int main() { using namespace std; cout<<"Hello, world!\n"; } …cplusplus] #include <iostream> int main() { using std::cout; cout<<"Hello, world!\n"; …=cplusplus] #include <iostream> int main() { std::cout<<"Hello, world!\n"; } [/… Re: std:: Programming Software Development by carnage i was about to ask this question too so what's the proper way? i always do declare globally this one [code=c++]using namespace std;[/code] should i just declare this one globally instead (if i'm using it) using std::cin; using std::cout; Re: std:: Programming Software Development by Narue >using namespace std; >is required for u 2 be able to use … No, it's not. You have to qualify for the std namespace to use any standard name, but a using directive… Re: std:: Programming Software Development by invisal … amount of time. For example: [icode]using std::cout;[/icode] and [icode]using std::cin[/icode] are the most common function that… std:: Programming Software Development by IIMarckus Hey guys, I just have a simple (?) question. What difference is there, if any, between [inlinecode]cin[/inlinecode] and [inlinecode]std::cin[/inlinecode] (for example)? If the latter is better form, why is it so? Re: std:: Programming Software Development by plgriffith Unless you are at a professional level there are very few times where you shouldn't include using namespace std; ...unless of course you want to learn something. Re: std:: Programming Software Development by c++ prog using namespace std; is required for u 2 be able to use cin only Re: std:: Programming Software Development by Ancient Dragon [QUOTE=carnage;523468]i was about to ask this question too so what's the proper way? i always do declare globally this one [code=c++]using namespace std;[/code][/QUOTE] Didn't you even bother to read the rest of this thread ? Re: std:: Programming Software Development by IIMarckus Thanks a lot guys. I'm still pretty new to C++, so this really helped me out. So the line [inlinecode]using namespace std;[/inlinecode] has nothing to do with using iostream over iostream.h? Guess that's another misconception cleared up. Re: std::endl vs newline Programming Software Development by rubberman A newline in a string is just some more data to send, whereas std::endl will send a newline and then flush the output. You can also use std::flush to flush the output in those cases where you don't want a newline (input prompts for example). IE: `cout << "Enter code:" << std::flush;` Re: std::endl vs newline Programming Software Development by deceptikon … output statement and the stream must be flushed with `std::endl` or `std::flush` are surprisingly rare, mostly due to tied streams… std::vector access violation on push_back Programming Software Development by sciwizeh …include <fstream> std::string parse::stringFromFile(std::string filename){ std::ostringstream oss; std::ifstream file(filename); if(…SymbolNode { public: SymbolRootNode(); void add(std::string s); std::string ancestry() const; std::string nextSymbol(PushbackPtr r, int first… Re: std::vector access violation on push_back Programming Software Development by sciwizeh …The Token constructor looks like this: TokenType ttype; std::string sval; double nval; Token() : ttype(…sval(""),nval(0){} Token(TokenType tt, std::string s, double d) : ttype(tt),sval(… just: TokenType type() const {return ttype;} std::string strval()const {return sval;} As far … std::tuple and boost::tuple don't support rvalue reference? Programming Software Development by stereomatching … something like this [code] std::tuple<std::string> kkk() { std::string temp = "temp"; return std::make_tuple( std::move(temp) ); } [/code] This…(strMove) ); [/code] This one is okay [code] std::shared_ptr<std::string> strShared(new std::string("wawawa")); boost::tuple<… std::map help!! Programming Software Development by glenwill101 …gt;, Object*>::iterator {aka std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, Object*>…gt;, Object>::iterator {aka std::_Rb_tree_iterator<std::pair<const std::basic_string<char>, Object>… Object*, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<… std::copy a std::vector of std::pair to std::cout Programming Software Development by Dave Sinkula …it != wavs.end(); ++it ) { string temp(*it); std::pair<string, string> entry; entry.first = ….second = temp; renamer.push_back(entry); } std::copy(wavs.begin(), wavs.end(), ostream_iterator<string…>(cout, "\n")); std::copy(phrases.begin(), phrases.end(), ostream_iterator<…