Forum: C++ Dec 15th, 2004 |
| Replies: 4 Views: 2,356 Heres a simple solution using the stl
#include <iostream>
#include <algorithm>
#include <vector>
int main()
{
//sort using a char array.
char cArr[] = "15462"; |
Forum: C++ Dec 9th, 2004 |
| Replies: 4 Views: 3,230 Your code compiles ok on vc++ 6. Your only calculating the julian day number using year, month and day. You need to do the same for year2, month2, day2 and then find the difference between the two... |
Forum: C++ Dec 9th, 2004 |
| Replies: 6 Views: 2,800 Have you thought of using the sort algorithm in the stl, and a compare func
struct containerCompare
{
bool operator()(const Type& p1, const Type& p2) const
{
//compare your... |
Forum: C Dec 9th, 2004 |
| Replies: 2 Views: 4,885 If your working with MFC, theres a function
CreateProcess(.........)
That will launch an exe in its own thread. Its up to you to keep peeking at any messages it sends. Dont know if this is... |
Forum: C++ Dec 9th, 2004 |
| Replies: 3 Views: 7,651 Fist thing you need to do is change the prototype of triangleShape. Since it has to usethe lengths of the triangle you need to pass them into it. It needs to look like
....triangleShape(float... |
Forum: C++ Dec 7th, 2004 |
| Replies: 11 Views: 3,598 Just to agitate things up a little. The problem can aslo be solved by use of const or non-const reference members and is similar to the pointer version.
class classone
{
public:
... |
Forum: C++ Dec 7th, 2004 |
| Replies: 2 Views: 20,982 Heres a snippet in mfc for finding a file of form *.extension in directory = myDirectory
// Get a list of files
CFileFind finder;
BOOL finding = finder.FindFile (myDirectory +... |
Forum: C++ Dec 6th, 2004 |
| Replies: 6 Views: 10,165 Yep better and easier to use vector. The orig post referred to an array so i thought i would be strict and stick with that. |
Forum: C++ Dec 6th, 2004 |
| Replies: 4 Views: 3,753 Firstly, a struct is almost the same as class. The only difference is that evrything is public by default. For a class the default is private
Secondly what you are trying do do with the cast is... |
Forum: C++ Dec 6th, 2004 |
| Replies: 6 Views: 10,165 My mistake. I originally wrote it using a vector then realized i could convert it to use an array, then forgot about .end() for the array. |
Forum: C++ Dec 6th, 2004 |
| Replies: 6 Views: 2,039 Swithc works with integral types, so inPlanet (float) will not work. Instead, try this
cin >> planet; |
Forum: C++ Dec 6th, 2004 |
| Replies: 6 Views: 10,165 You can use max_element
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int)
{
const int len = 3; |
Forum: C++ Dec 6th, 2004 |
| Replies: 3 Views: 2,133 atoi requires const char*as an argument. string is a specialization of basic_string and is not a const char*. Call method c_str() on the string to get const char*. string owns the memory for the char... |