Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Was there a prerequisit for that class? Have you taken those presequisite classes? Have you read the chapter(s) in your textbook? Maybe you need to start with a project a lot simpler so that you can learn the basics as you go along.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That first error is telling you that SString class does not have a constructor that takes a SString object by reference. You will probably have to either add one, or change line 330 like this: int len = str_length(_string) + str_length(rstring._string);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 5: class is misspelled.

line 8: you must specify a length if you want to use a character array. If you want to use dynaming array allocation then use a pointer -- char* _string; line 49: you must end the class declaration with };

The constructor with two parameters should be this:

string::string(char *array, int size)
    {
             int i;
	    _string = new char[size+1]; // +1 for the string's null terminator character
	    for(i=0; i < size; i++)
	    {
            _string[i] = array[i];
	    }
        _string[i] = 0; // add string's null terminating character
    }

line 294: I don't know what you want to return here, but what you have coded isn't correct.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No -- the name of the file has little, if any, relationship to the class name(s) that are in it. The name of the header files doesn't have to be the same as the class thats in it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

function getData()
1) You did not open the file. I suggest you use ifstream instead of fstream because I think its easier to use. ifstream file("MenuData.txt"); You didn't post the contents of the data file so I don't know how it should be read. But I'm sure its not like the loop you posted. Post a few lines of the file and we can give you more help with that.

Line 12: should be a space, not a period in that line.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It will help to know what the error messages are. I'm supprised those compiled with a MSWindows compiler. You can't leave both dimensions of the arrays unspecified

void printOctets(int octets[10][], char []); 
void printInterval(int suntwk[10][], int brdc[10][]);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

PM your address and I'll mail you a copy of the dvd (yes its a legal copy, I download the ISO fle and made my own dvd).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

string.h is the name of a standard C header file. You should name your header file something else so that you can get the functions that are in the standard string.h header.

Its not necessary to pass all those parameters to those string functions, because the string class already knows about the functions. And you don't need private functions that can be easily done in the public functions, such as str_length()

int str_length()
{
    return strlen(_string);

Thats all you need in the public function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

maybe:

:twisted: (Google "haskell maybe" if you are confused.)

/me runs away

Huh? That went a mile over my head :)

William Hemsworth commented: Your not the only one who thinks that :)! +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you have to use the function in string.h, such as strcpy() to copy a string, or strcmp() to compare two strings.

post the two classes so that we can be more specific.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you have a dvd class that contains string objects. Why are you writing your own string class when there is a perfectly good std::string class?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Microsoft Visual C++ 2008 Express is free and the newest of the M$ compilers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

One of the reasons your program craps out is because you are freeing up the memory that was allocated for the nodes. Delete line 90.

I compiled your program and it has several errors that you need to correct. I hope your compiler tells you about them. For example: you need to specify the return value for the functions. main() returns an int so you need to code it as int main() The same with the other functions.


line 9: next must be a pointer, so you need to code it like this: struct node* next; >>typedef struct node *nd;
It may be just a personal thing but I don't like using typedefs like that because it hides the underlying code. It's much clearer to write int foo(struct node** head) because you know immediately what the parameter is -- its a pointer to the top of the linked list.

It appears that you are inserting new nodes at the head of the linked list. If that is true then you can simplify the function like this: (note: I removed the gotoy() calls because it isn't supported by my compiler. Just use what you have coded for that).

void Insert(nd *head)
{  
    int x=14,y=1;
    nd temp;
    clrscr();
    temp = malloc(sizeof(NODE));

    printf("Last name: \n");
    scanf("%s", temp->lname);
    printf("First name: \n");
    scanf("%s", temp->fname);
    printf("Tel. Number: \n");
    scanf("%s", temp->telnum);
    printf("Address: ");
    scanf("%s", temp->address);
    temp->next = *head;
    *head = temp;

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

One reason that happens is because you compiled your program for debug instead of release. More than likely the computer you installed your program on does not have the Microsoft debug DLLs. Compile for release mode and retest.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That has been discusses at length in other threads. Seek and yea shall find.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

AFAIK there is no difference, other than naming.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The code you posted doesn't compile cleanly.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
struct node{
		  int next;
		  char telnum[15];
                  char fname[30];
                  char lname[30];
		  char address[70];
	}NODE;

NODE is an instance of the structure, not a typedef name. If you want a typedef name then code like this:

typedef struct node{
		  int next;
		  char telnum[15];
                  char fname[30];
                  char lname[30];
		  char address[70];
	}NODE;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think we need Jimmy Carter to organize a group of UN troops to oversee elections in USA. He does it in other countries, so why not here?

VernonDozier commented: Yep. We need to clean up our own house first. You'd think that after 200+ years of elections, we would have solved this? +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

MS-Windows puts "\r\n" as line terminating characters. *nix only wants "\n". So you need to remove the "\r" characters. You can either run the file(s) through a translation program, or write one yourself. It pretty easy program to write. If you used FTP to transfer the file then FTP client may have the option to translate the files.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What will they do with all those dead people who like to vote? We had quite a few of them here in St Louis the past few elections - and they all voted Democrats.

Dave Sinkula commented: It's too hard for me not to try to crack a joke. Must. Avert. Eyes. +16
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

^M is a carrage return -- '\r-- which is used to deliniate end-of-line on some operating systems. If you are transferring the file from *nix or MAC to MS-Windows then you need to replace it with "\r\n".

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

AFAIK there are no laws that require people to notify DMV when they move. So IMO purging people whose address doesn't match the DMV database is just silly, and very probably illegal, and apparently the Attorneys General of those states do too.

But theres a dillema: how can states legally and fairly correct the voter registration lists? I suppose one way is to put the lists through the paper shreder and require everyone to register when they show up at the voting poles.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This is what I get when I click that link

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

temp.a is NOT a pointer, so line 18 can't work.

int x=0;

for(x=0;x<=9;x++)
{
    n->a[x] = *b1++;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Step 1: create the text file that contains the commands

Step 2 write the c++ program using std::cin as you normally would. Here's an example

#include <iostream>
#include <string>
using namespace std;

int main(int argc, char* argv[])
{
    string line;
    while( cin >> line )    
        cout << line << "\n";
    return 0;
}

Step 3: on command prompt retired the text file into your program

c:>myfile <try.txt <Enter>

output:

C:\dvlp\test3\Debug>test3 <try.txt
smile
frown
speechless
exit

C:\dvlp\test3\Debug>
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I bought a new HP quad core with 64-bit Vista Home Premium a week ago because the computer I had finally died. So far no major problems. It just don't play a few games that I was agle to play with the 32-bit version. Also the Flash ActiveX don't install with 64-bit browsers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Better to buy a good book -- it will last longer and you can easily read/reread as often as you want. Books are also very handy to keep at your side while programming. You can look things up in a book while you can't do that with a video without watching the whole blasted video again.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

check the Recycle Bin and see if the os moved the files there. If they are there then you can just simply restore them.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Also here is a C File I/O tutorial to help you get started.

link is broken

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

try the same thing in a single threded program and you will probably get the same or similar results.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think you might be confused about the purpose of a batch file. Batch files are interpreted by the operating system -- not a program that you write. Yes, you can write a program that reads a batch file, but what will it do with it???

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since CountVowels() returns an integer, then the OUT parameter must be a pointer int CountVowels (char text[], counter_t* Count); I don't know what integer that function is supposed to return -- certainly not a counter_t object because that isn't an integer. If you make the second parameter a pointer as * showed above then you must also change the dot notation to pointer notation case 'a': Count->a++; break;

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

sql Do you mean Microsoft SQL Server, or do you mean the SQL language?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I use google exclusively -- if I can't find it with google then I assume it can't be found anywhere. I don't even consider yahoo search, not because I don't like it but because I consider google to be better. Am I right? maybe yes and maybe no. And do I really care? No.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Thanks, I'll try that, but it'll stop it for both objects.

Of course it will. That's not a problem though. What you want to find out is the value of numDay -- is it 0 based or 1 based ?

And this is a good exercise in learning how to use the debuger.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Use your compiler's debugger, put a breakpoint on that function, and find out why it prints the wrong day of the week. My guess is that dayNum is wrong -- Sun should be 0, but dayNum may use 1 for Sunday.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your first code prints c++ for me using VC++ 2008 Express. What compiler are you using?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

MessageBox is a win32 api function and requires windows.h

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Somehow seems as if the "stdio.h" doesn't recognize the type File
That's correct because there is no such thing in stdio.h -- its FILE (all caps).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is this just a silly joke? If not, then write it yourself.

LizR commented: Awsome reaspose (Liz) +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Please quote the exact problem because what you posted doesn't make a lot of sense. One possibility is this:

void foo( int a, int b, int c, int*sum, int* average)
{

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read this article. I don't know if it will help you or not.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I thought of that too, so I added pragma to force link with the library and it still won't link.

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <winsock.h>
#include "mysql.h"
#pragma comment(lib,"C:\\Program Files\\MySQL\\MySQL Server 5.0\\lib\\opt\\libmysql.lib")
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

World Community Grid is similar to Folding@Home. I have created a new DaniWeb team account that everyone is welcome to join. You can have both Folding@Home and World Community Grid running on the same computer. I started this new account because I was disassitified with the software available at Folding@Home. I got a new 4-core computer and Folding didn't have software that can take advantage of all those processors. The software I downloaded from World worked right away with all 4 processors.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did you see this link ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Here's a correction
I'm afraid not. Line 38 is wrong.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1) I would create a structure that holds the count and string for each word

struct words
{
    std::string word;
    int count;
}

Now have a vector of these structures vector<words> wordList; Now when you get a word, search the vector for occurence. It its already in the vector just increment the counter. If not, add a structure to the vector.

as for using strcmp() -- dump it. You don't need it because you can use std::string's == operator to determine if the two strings are equal. And its not necessary to sort the words if you use my suggestion above.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Alex Edwards commented: Long live Google! =P +4