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

You don't have to clear the screen, just move the cursor back to the beginning of the line

cout << "\r" << number;

That will work only if you want to print the number at the beginning of the line.

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

ban weapons will stop crime and murders.

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

Did you google for tutorials? (link)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
diafol commented: nice +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you need to post the structure. Are the structure members pointers or character arrays?

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

Your program is just tooo complicated. This is all you need.

int i = 0;
while( fgets(line,sizeof(line),sourcefile))
{
     Array[i].name= dupstr(strtok(line,";"));
     Array[i].job= dupstr(strtok(NULL,";"));
     Array[i].salary = dupstr(strtok(NULL,";"));
     ++i;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No. You need to restore from a backup (you DO make backups occasionally, don't you???)

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

You can't (easily) replace it, but you can hide the current window and call tne new window's ShowDialog().

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

line 11: <=9 should be just <9 because there is no 9th element in that array.

line 13: should be printf("please input numbers\n"); no need for "%s"

line 14: "%s" is fof strings, "%d" or "%i" is for integers.

line 16: should be <8 not <=8, you want to run the loop 1 less than the number of elements in the array. Since there are 9 eledments in the array the loop should run 8 times (0, 1, 2, 3, 4, 5, 6, and 7)

line 18: should be <9, not <=9, for the same reason as that given for line 11 above.

tux4life commented: Made my post redundant ;-) +13
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

All c++ compilers mangle c++ function names (functions in *.cpp files), for example the function void foo() may be actuslly foo@4 in the object/library files. Since you are trying to mix C and C++ files you need to tell the c++ code that aft2dboundary() is a C function, not a c++ function. This is how to do that

// main.cpp
#include <aft2.h>

extern "C" void _cdecl aft2dboundary(int *, double*); // <<<< function pro9totype

int main()
{
   // blabla
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Post the code you have written so that someone can help you. You will need to know about loops.

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

put it in a module

Module ConnectionHelper
    Public Function foo()

        'Begin reading config file to receive database info
        Dim fileReader As System.IO.StreamReader
        fileReader = My.Computer.FileSystem.OpenTextFileReader("config.txt")
        Dim configvars(0 To 3) As String
        Dim count As Integer = 0
        Do Until count = 4
            configvars(count) = fileReader.ReadLine()
            count = count + 1
        Loop

    End Function
End Module
TnTinMN commented: that works +6
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is a better and easier solution. Note: you will also have to press the <Enter> key becuse C does not have a standard function to just get a single key. You could use functions in conio.h to do that, but be warned that not all compilers support that because it's non-standard.

int main()
{
    int quit = 'N';
    while( quit != 'Q' )
    {
        // do something here

        printf("Do you want to continue? (Press Q to quit)\n");
        quit = getchar();
    }
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to DaniWeb Fredrick. You'l have to be a lot more specific about what you want. Post some code and ask questions about what you don't understand then I'm certain someone will help you.

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

Of course you can do it in your program, there are lots of tutorials thatg show how to connect to a database and run sql commands. Here is a small list of them.

In the case of the DateTime picker, there should be an OnClick event in which you put the code to query the database.

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

The package you downloaded should contain a *.lib file, you need to tell the compiler/IDE that it needs to find the function in that library.

There are a couple ways to do it

  1. In one of your *.cpp files add this to near the top of the program, after all includes
    #pragma comment(lib,"somelib.lib") Replace somelib.lib with the actual name of the librarfy

  2. Go to Project --> Properties (bottom of the menu) --> Configuration Properties --> Linker --> Input. On the right side is "Additional Dependencies". Add the name of the library there.

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

My dog ate my homework

Write this program for me because I can't.

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

You need to learn about pointers, malloc() (for dynamic memory allocation), FILE* (for file i/o), scanf() or fscanf() to replace cin, and printf() to replace cout. Read (google) a C tutorial and you will learn how to do all those things.

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

I always copied it into an unsigned char 4-byte buffer

DWORD dwValue = 123;
unsigned char buf[sizeof(DWORD)];
memcpy(buf,&dwValue, sizeof(DWORD);

Or you could just typecast a pointer
unsigned char* ptr = (unsigned char*)&dwValue;

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

What database server are you using? Most of them don't let you change the path, it's established when the database server is installed. And after thinking about it I don't think you can create a new database via programming languages because the language has to have a connection to an existing database in order to run sql commands.

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

look in the Release or Debug folder (whichever one you are compiling) and you will find the *.exe program. All you need to distribute is that file

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

button.click is not a property, it's an event handler which doesn't return anything. your program can call the event handler from anywhere, just pass it the two arguments.

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

Good! that's the whole point of turning it off. If you need to connect a new device then turn it back on, connect the device, then turn it back off.

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

Here is a very very simple example. AFAIK VB.NET can not call c++ functions or c++ classes because the c++ compiler will mangle the names. You need the *.def file to prevent the compiler from mangling C function names. Using __delspec(dllexport) isn't enough because VB will still do some name mangling. e.g. test function becomes _text@4. VB.NET hates the @4 in the name.

; vb.net program

Module Module1
    Private Declare Function test Lib "name and path of dll on my computer" (ByVal b As Integer) As Integer

    Sub Main()
        Dim b As Integer = 10
        Dim c As Integer
        c = test(b)
        Console.Write(c)
    End Sub

End Module

Below is the DLL

#include <windows.h>

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

    long _stdcall test(long a) 
    {
        return a * a;
    }

And this is the *.def file for the DLL projecgt

LIBRARY "name of the DLL goes here"
EXPORTS
   test
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes you can make libraries that interface with VB. The major changed is in the way strings are handled. Depending on the version of vb you want to use, here is an article by Microsoft that illustrates how to call DLL written in C by VB. Another article is here. If you use c++ it may b a little more difficult because c++ mangles names, so vb will have to know the mangled name.

If you want to use char* in the parameter list of the dll function then in VB you must declare String data type. VB lets you use data without declaring them and when that happens the are of type VARIANT (link) in C/C++.

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

Last name and first name are separated by a space, so fscanf() won't [easily] work with it. It's a lot simplier to just call fgets() to read the entire line at one time, then use strtok() to split it by ';'

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

"Send me $10.00 USD and I'll mail you my book about how to get rich quick"

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

for (int i=5;i--;){

I know what you mean, but it would be better to make a standard loop that newbe can understand and that us oldies don't have to think very much about (our thinking power is somewhat diminished)

for(int i = 4; i >= 0; i--)

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

Wish granted, you are President of Hostess Inc., which is now bankrupt and up for sale. WalMart is one of the potential buyers.

I wish for nothing, already have everything I want or need.

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

The example you posted doesn't make any sense to me. If you input 5 numbers 1 2 3 4 5 the inverse is 5 4 3 2 1, is that what you want?

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

Why would you need to do that, other than being a hacker who likes to shut down people's wifi networks? If you want to turn it off just log into the router and turn it off. Once off you don't need to turn it back on.

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

Happy (Hic!) New Year. The best part is that the world didn't come to an end in December :)

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

My question however; Is it a good idea to "generally" stick with getline input, or can I use getchar when only needing a character (such as a 'y' or 'n').

When you type the 'y' or 'n' you also type the Enter key. You have to call getchar() twice if you want to empty the keyboard. But what if I actually type "yes" or "no" instead of just 'y' or 'n'? getline() will empty the keyboard buffer regardless of how may keys you type (assuming you use std::string or char array that is larger than the number of characters in the keyboard buffer).

Programmers have lots of problems with getchar() because they fail to empty the keyboard buffer of the '\n' character before asking for more keyboard input using getline(). getline() will see the '\n' in the keyboard buffer and stop.

So, IMO use getline() with std::string simply because it's easier and safer to use.

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

I've Downloaded Visual Studio Ultimate Which is Great!

Did you get the free 90 day trial version, or did you get the illegal free version. I'm certain you didn't pay $10,000 USD to get it legally.

mitrmkar commented: Hehe, you might be onto something here ... +14
triumphost commented: You can get it on DreamSpark free if you go to school :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This is what you want in the General.cpp file, you need to identify the namespace. Dp the same with lowerbound.

int counternamespace::upperbound = 12;

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

line 10 is incorrect. The = is an assignment, and the == is comparison (boolean). The mikddle part of that loop statement tells how many times the loop is to run, so if you say c == 0 then you are saying the loop continues until c becomes 0. Since the value of c is already 0 (at line 7) the loop will do nothing. You need to put something else there so that the loop will print something the desired number of times. If you want the loop to continue 10 times than do this

for(i = 0; i < 10; i++)

[edit]What ^^^ said :)

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

post current code

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

std::filestream is not c++, it's CLR/C++ (for .NET) which is a different language.

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

You'll find yourself segwaying from one desire to another..

Very true. I am segwaing between Jack Daniels (Hickup!) and Irish Mist. :) Happy New Year!

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

Have you tried this suggestion?

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

.will u modify that for me?

No. All you have to do is put all that code in the header file and delete the two *.cpp files.

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

BTW I know nothing about that library.

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

I can't edit a post I just made. The edit button does nothing but take me to the top of the page.

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

License is shown at the bottom of this page

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

gdeneral.h is declaring two variables and that header file is included in both analyzer.h and test.h. The same variables can't be declared more than once or you get that link error.

The work around is to use the extern keyword in general.h and then declare the same variables again but without extern in one of the *.cpp files

#ifndef GENERAL
#define GENERAL
namespace counternamespace{
    extern int upperbound;
    extern int lowerbound;
}
#endif
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you will feel better after the New Year.

Unless he has a huge hang-over :)

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

Do the same with all the other functions. I already told you what you need to do to fix all the problems.

.how can assign type before compile..?

The type is assigned when you instantiate a template which is why you can't put the template's implementation code in a *.cpp file.

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

Yea, I see that endorse buttons do nothing.

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

The problem is that you put the implementation code in separate *.cpp files instead of as inline code in the header files. You can easily prove this by replacing the constructor in the cpp file with inline code in the header file then recompiling. That will remove the constructor error. The reason is because templates can't be compiled before the data type is known. How is the template supposed to know what kind of data is Head when CircularLinkedList.cpp is compiled? It doesn't. This is one reason why you see a lot of inline code in template header files.

You're going to have to get rid of both *.cpp files (CircularLinkedList.cpp and ListNode.cpp) and move all that code into the header file as inline methods.

template <class T>
class CircularLinkedList{
public: 
    CircularLinkedList() {Head=NULL;} /* constructor */