•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 374,572 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,817 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
•
•
•
•
•
•
•
•
Frequently, you may need to isolate words in a phrase. In this example, we'll use substr to carry out this task. (View Snippet)
This is a neat little program to calculate the date of easter in any given year. The principle is based on the julian calendar. (View Snippet)
First off, C++ does not know anything about the I/O device you are using. It can be a keyboard and monitor, or a file, or a network connection, or anything which can do I/O. What that means is that there is no standard way to do this in C++.
That said, the following should work on any Unix/Linux... (View Snippet)
This is a simple example of how to delete a line from a text file. In order to do that you have to completely rewrite the file, leaving out the line(s) you want to delete. First open the input file, then open an output file (doesn't matter what filename you give it as long as its a legal file... (View Snippet)
hello frnds this is a snippet that removes comments of c, c++ , java files (View Snippet)
This snippet will allow you to separate or "explode" strings into vectors via a character separator or the visa versa. In which case you would take a vector and "implode" it into a string separated by a character. Also keep in mind that this requires the libboost libraries. This was tested on Linux... (View Snippet)
Generates all primes till n terms. Not a wonder scripts which will generate till billions, but works pretty fine till few millions. (View Snippet)
A simple solution that prints the first n values in the fibonacci series up to the limit of an unsigned long. The program takes either command line arguments or interactive input for n and has code in place to make the program more flexible, like printing to a file. (View Snippet)
Code will check whether the number entered is integer or not.
ignore extracts characters from the input sequence and discards them. The extraction ends when max characters have been extracted and discarded or when the character delim(\n) is found, whichever comes first.
In the latter case, the... (View Snippet)
For anyone who gets fed up with the somewhat verbose syntax involved in populating an STL map container with static arrays of std::pair (Or any of the other somewhat tedious ways of writing 'pair' combinations), here is a function which allows two different (statically allocated) arrays, of equal... (View Snippet)