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

you forgot to initialize temp->next = NULL; at between lines 28 and 29, so at line 37 it can not find the last node.

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

Note that you have to allocate a new node on each iteration of the file read.

while( fd >> surn >> initial)
{
       temp1 = new phonenode;
       strcpy(temp1->surn, surn);
       strcpy(temp1->initial, initial);
       if( start_ptr == NULL)
      {
             // Add new node to the head of the linked list
      }
      else
       {
            // add new node to the tail of the linked list
       }
}

}

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

lines 31 and 32: what are you attempting to do there? chara arrays do not have overloaded operators such as >> If you want to copy the arrays then use strcpy() function. Either read your textbook or google to find out how to use that function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
void function( char passedArray[])
{
char localArray[10]="my String";
// here i have to use that charArray as string and have to compare it with
// localArray.
    
    if( strcmp(localArray, passeedArray)== 0)
         cout << "The two strings are the same\n";
}

int main()
{
char charArray[10] = "Hello";
function( charArray);

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

Thanks, I will research that process.
How does one gain a trusted certificate?

Read the link!

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

I like to look at threads with no replies to see if I can help. Making the 0 in bold red helps to quickly locate them, even though there is the "Unanswered Threads" link.

William Hemsworth commented: same :) +0
Nick Evan commented: agreed +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Now I haven't enterted the void function yet. But is it ok if I able to use if statements in the void function?,

All a void means is that the function will not return anything. Other than that, there is no restrictions on what void functions can do or the type of statements is can contain. If you think your void function needs if statements then by all means include them.

>> highest = S[4];
That should be hightest = S[0]; . There is no 4 in array S, only 0, 1, 2 and 3.

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

You mean something on the order of this:

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

class A
{
public:
    A() {a = 0;}
    void common_interface()
    {
        cout << "class A\n";
    }
protected:
    int a;
};

class B
{
public:
    B() {b = 0;}
    void common_interface()
    {
        cout << "class B\n";
    }
protected:
    int b;
};

class C : public A, public B
{
public:
    C() {};
    void common_interface()
    {
        a = b = 1;
        cout << "Hello World\n" << a << " " << b << "\n";
    }
};

int main()
{
    C c;
    c.A::common_interface();
    c.B::common_interface();
    c.common_interface();
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It means the compiler doesn't know what string is. You failed to include <string> header file. After doing that, you need to declare strings as being part of std namespace: int find(const std::string& str);

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

1. Use binary search to locate an instance of the number it should be looking for.

2. Back up the list until you find the index whose value is different than the one you want. That will give you the starting counting point.

3. Search forward until it finds a different value, counting the number of instances along the way.

int key = 3;
int index, i;
int array[] = {1,2,3,3,3,3,4,4,4,5,5,5};
int size = sizeof(array)/sizeof(array[0]); // number elements in array
// This will get you the index into the array where key is found
int found = binary_search( array, size, key); 

// now back up until either the beginning of the array or the first array 
//value that is NOT key
for(i = found; i >= 0; --i)
{
    if( array[i] != key)
       break;
}

// now count the number of values in the array that
// are the same as key
int counter = 0;
while(i < size && array[i] == key)
   ++counter;

// now you should have the correct recult
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Another way to do it is to use a temp variable for the input

char temp;
cin >> temp;
guess += temp;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

My Favorite Forums ??? Yes I like that too. Also like the new rep counters.

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

Your program is pretty close, you just need a few changes, such as int main() , use pointer to array in scanf() and flush out the '\n' characters

int main()
{
	int array[50],i,ele,n;
    char a;
	//clrscr();
	printf("the list should be sorted in ascending order\n");
	printf("enter the size of array\n");
	scanf("%d%c",&n,&a);
	printf("enter the elements\n");
	for(i=0;i<n;i++)
	{
		scanf("%d%c",&array[i],&a);
	}
	printf("enter the element to be searched\n");
	scanf("%d%c",&ele,&a);
	binary(array,n,ele);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

use fgets() instead of scanf() because it avoids buffer overflow problems if you type in more characters than name will hold. On the flip side of the coin you will have to remove the '\n' that fgets() will probably tack on to the end of the string. fgets( person->name, sizeof(person->name), stdin); person->name[strlen(person->name] = 0; Another reason to use fgets() is so that you can enter names that contain spaces. scanf() will not allow you to do that.

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

>>don't forget to put a space after the back slash otherwise it will be an invalid character.

No, that doesn't fix it. You have to put two \\ if you want one in the text, such as system("copy MagsG.exe C:\\"); The space has nothing to do with fixing the error.

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

why do you need to keep all the old guesses? If the guess is wrong then just toss it out and ask for another guess.

cin >> guess[n] is attempting to treat guess as if it were an array, which is isn't at that point. guess is nothing more than an inunitialized string with no length, so trying to index it like that will fail. To fix it just simply remove the index into guess cin >> guess; On the otherhand if you really do want them to enter just a single character then you need to initialize guess to the correct length, such as guess = " "; // 5 spaces then the indexing will work

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

read the loop I created for you more carefully -- what you posted isn't the same.

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

>>i was assuming that if i == 0, then words would make it i == -1, and that violated vector rules?

Impossible. If you initialize i = 1 then it can never ever be 0 without creating a data overflow condition by incrementing i too many times.

>>for (unsigned int i = 0; i < words.size(); ++i)
That is NOT the same as what you posted before, which is what I responded to. IMO you are making the wrong comparisons

for(size_t i = 0; i < words.size()-1; ++i)
{
    if( words[i] == words[i+1] )
    {
        // blabla
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

deleting the files is simple -- just call remove() function. finding out which ones have not been accessed during the previous 5 minutes is more problematic. By "accessed" do you mean opened for reading, writing or either?

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

line 28: why is it testing for i != 0??? I is initialized to 1, so it will never be 0.

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

The tags are already separated by commas.

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

You failed to use code tags again.

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

lines 28-33 are wrong. You can not read a file into a const value, but use variables

int arry[6];
for(int i = 0; i < 6; i++)
   inFile >> arry[i];
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That takes too much processing and CPU time. Just use the win32 api function Sleep(int seconds), and don't forget to include windows.h header file.

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

That's still wrong -- use the = assignment operator, not the == boolean operator.

vector<string> words(4); //Create 4 elements for now
	words[0] = "roller coasters";
	words[1] = "waiting";
	words[2] = "people who talk on the phone while driving";
	words[3] = "wars";

Or use push_back() method if you don't know how many strings will be added to the vector

vector<string> words; //Create 4 elements for now
	words.push_back("roller coasters");
	words.push_back("waiting");
	words.push_back("people who talk on the phone while driving");
	words.push_back("wars");
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The two loops are wrong

for(x = 0; x < l-1; x++)
    {
          for(y = x+1; y < l; y++)
          {
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I meant for you to correct the code in your post #3, not to mearly restate the program requirements. The code you posted is nearly unreadable. Fix it up with proper intentations (spacing).

>>please send me in c or c++
No. You have to develop the program yourself.

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

>>I'm using Dev-C++. I know its outdated, but last time I downloaded VS it totally screwed up the computer I was using and I had to get a new hard drive, so I really don't want to mess with it again.

??? Never heard of that before

In Dev-C++ you should have first created a project by selecting File --> New --> Project, then in the dialog box select Console Application. After the IDE finishes creating the project you can add the *.cpp and *.h files to the project.

>>I'm not sure about what you mean about how I'm linking them together,
When you have several *.cpp files they each have to be compiled into object files (your compiler will create *.o files). After that the linker has to put all those *.o files together along with the libraries (*.a) in order to create the executable program. Most (if not all) of the libraries you will be using for the forseeable future will be supplied by your compiler.

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

Please edit your post and use code tags

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

I rarely have a problem at 1024x768, and the bug I reported should probably be pretty low on your TODO list. It's not really that big of a deal for me.

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

Which do you want, a C solution or C++? And what have you tried ?

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

What compiler are you using (if you already told us in another thread then tell us again because I don't want to have to read all your other posts to find out). And how are you linking all those files together ? Are you doing command-line or IDE builds ?

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

The best thing about Code::Blocks is that it's been ported to both *nix and MS-Windows. I wouldn't doubt that it also has a MAC port too. That means you don't have to learn different tools on Vista and *nix.

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

Sorry, I consider 1024x768 low screen res.

Yea, but your eyes are young. Give yourself another 10 years and you too will probably have to start using that low resolution.

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

Mine is set to 1024x768

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

If you dual-boot Vista and Fedora or Ubuntu then Thunderbird email client can use a common email box for both operating systems. If you already have an email account set up on one of the operating systems, such as Vista, then open Thunderbird, select Tools --> Account Settings, then click the Local Folders link on the left side of the screen. On the right side you will see the current location of the email files under Local Directory. Write that down someplace so that you can reference it while booted in Fedora.

Now close Vista and boot to Fedora (or Ubuntu). While in that os, install Thunderbird if it has not already been installed (use Add/Remove Programs to do this), then set up your email account. After that is installed, again open Thunderbird, select Tools --> Account Settings, click the Local Folders tab, then use the Browse button to navigate to the same folder that is used in Vista.

That's all there is to it :) Now you can use all the same email messages in both operating systems. When new mail arrives it will be seen by Thunderbird in both operating systems.

majestic0110 commented: Nice ! +6
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

CHAR_MAX is undefined -- and should be declared as const int CHAR_MAX = 255; Anything smaller than 255 and that function might scribble outside the bounds of the array.

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

Hello please how can i get a pointer value that is in for loop???

The star dereferences a pointer int x = *poionter;

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

MS-Access is a great database for small projects. Its ok for 1-3 simultaneous connections. Anything more and Access can generate file corruptions.

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

Happygeek is a really big tweetgeek :) I suspect he spends most of his time searching blogs.

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

Thanks for that, I do not know if I used the correct args (Visual C++, though I dont understand the GUI so I use Notepad++ with cmd line)

You should take the time to learn so that you can program more efficiently and easier. You are currently using 50-year-old technology (command-line build).

How to create a project.

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

>>Is this just for newbies not using code tags or something?
That is one reason, but not the only reason.

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

>>The solution was to put "libcurl.lib" in the same directory as the C++ source file which I also added the following line to so it can see the lib.

That may be one solution, but not the best solution. The best solution is to tell the compiler where the library is located. How to do that depends on the compiler. If compiling from the command-line then more than likely you give it a -L <path> flag, such as g++ -L c:\libcurl\lib file.cpp -o a.out If you are using an IDE such as VC++ 2008 then add the library path to the Projects settings link tab.

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

All you have to do is compile it for Release instead of Debug. You may have to install some Microsoft dll's found here: "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT" if the computer does not already have them or newer versions of them.

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

What kind of equipment do you have access to that can interface with a computer? Or do you plan to spend lots of $$$ out of your own pocket for it?

Maybe an oscilloscope ?

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

Here is another ODBC example that uses MS-Access and the Northwind example database. It does not cover everything that can be done with ODBC, just the basics of how to connect, run a query and get the results.

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

write a simple compiler??

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

Is is possible for you to reduce the amount of negative rep I can give from 30 to something more reasonable, say 10? I'd like to occasionally give negative rep but I don't want to completely destroy the member. Maybe there should be a maximum negative rep that can be given.

crunchie commented: Great idea :) +0
happygeek commented: I like that idea +0
Dani commented: Thanks for the suggestion :) +0
tux4life commented: Very good idea, I like it. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

using FF 3.5.3 and attached is how that window looks.