WolfPack 491 Posting Virtuoso Team Colleague

No. There is no issue like that with Visual Studio 2005 Express Edition. It is completely free for as long as you want to use it. Earlier it was only for a one year period and the licence expired after an year. But now they have decided to give this edition for free. See this.

Effective April 19th, 2006, all Visual Studio 2005 Express Editions are free permanently. This pricing covers all Visual Studio 2005 Express Editions including Visual Basic, Visual C#, Visual C++, Visual J#, and Visual Web Developer as well as all localized versions of Visual Studio Express.
SQL Server 2005 Express Edition has always been and will continue to be a free download.

See how nice Big Bro Bill is?

WolfPack 491 Posting Virtuoso Team Colleague

Why do you want to buy it when it can be downloaded for free?

WolfPack 491 Posting Virtuoso Team Colleague

First of all, I must say that your question is really very well presented, complete with the compiler versions, operating system versions, full code and error report. It really makes answering it easy in our part. if only all the posts were formatted like yours...

Remove the line

#include "stdafx.h"

and replace it with

#include <stdio.h>

. slice.cpp should compile.

As for these errors,

slice : warning PRJ0041 : Cannot find missing dependency 'winwlm.h' for file 'slice.rc'. Your project may still build, but may continue to appear out of date until this file is found.
slice : warning PRJ0041 : Cannot find missing dependency 'macwin32.h' for file 'slice.rc'. Your project may still build, but may continue to appear out of date until this file is found.
slice : warning PRJ0041 : Cannot find missing dependency 'macwin32.h' for file 'slice.rc'. Your project may still build, but may continue to appear out of date until this file is found.
slice : warning PRJ0041 : Cannot find missing dependency 'macwin32.h' for file 'slice.rc'. Your project may still build, but may continue to appear out of date until this file is found.
slice : warning PRJ0041 : Cannot find missing dependency 'macwin32.h' for file 'slice.rc'. Your project may still build, but may continue to appear out of date until this file is found.
slice : warning PRJ0041 : Cannot find missing dependency 'macwin32.h' for file 'slice.rc'. Your project may still build, but may continue to appear out of date …
WolfPack 491 Posting Virtuoso Team Colleague

Re: Syntax....
Maybe we can answer your question and mine at the same time.

I am a total neophyte, but I am toying with a program that has a caveat, "When using VS2005, MS is pushing wide strings. Convert char stuff to WCHAR and put an L in front of all the constants, like this: L'Hello, world.'"

This is all pretty much greek to me, but maybe a power hitter can enlighten us.

That is because unlike the previous versions of Visual Studio, VS2005 is unicode enabled by default. In Windows, to differentiate between Wide char and the normal one byte char, you have to put the L modifier in from of it. So "Hello World" will take 12 bytes, and L"Hello World" will take 24 bytes.
Read more.

As for the OP's question

In visual c++ 2003 to visual c++ 2005 are there any major changes,Are there any Syntax changes i know there has to be,and would the 2005 version be worth the money?

No major changes in the Graphical IDE. If you are familiar with the VS2002, VS2003 , there are few places where you get surprised.
As for syntax changes, I tried the Professional Version for some time, and the major irritation was that the use of functions like strncpy has been deprecated in favour of microsoft specific functions like strncpy_s. So you may get a lot of compiler warnings saying this and that is deprecated, blah blah blah. Of …

WolfPack 491 Posting Virtuoso Team Colleague

And someone has just voted beer

judging from some recent posts, I'd say that was dave. :twisted:

WolfPack 491 Posting Virtuoso Team Colleague

Question : Why do they call it PMS?
Answer : Because Madcow is already taken.

WolfPack 491 Posting Virtuoso Team Colleague

S Club 7 :cheesy:

WolfPack 491 Posting Virtuoso Team Colleague

Inline code tags are used when you want to have pieces of code appear within a sentence.

When posting large pieces of seperate code use code tags.

WolfPack 491 Posting Virtuoso Team Colleague

Correction. You should have the Registry Version in the heading of the reg file. I missed that in the above post unfortunately. I think it differs depending on the windows OS version. But version 5.00 should be okay for Windows XP and above. I dont know about previous versions. You can find it by running regedit.exe from Start Menu + Run, and clicking Help + About Registry Editor.

This is the complete .reg file.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_root]
@="Open Root Console Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_root\command]
@="runas /user:COMPUTER_NAME\\AdministratorName \"Cmd.exe /k pushd %L\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_root]
@="Open Root Console Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd_root\command]
@="runas /user:COMPUTER_NAME\\AdministratorName \"Cmd.exe /k pushd %L\""
WolfPack 491 Posting Virtuoso Team Colleague

This is a modification of the Add Command Prompt Here tweak that is fairly common in the internet. What the original tweak basically did was, create a shortcut in the Directory/Drive Context Menu of Windows Explorer when clicked executes a command prompt with the clicked directory as current directory.

This modification was created so that I could run a root console from any directory or drive even when I was logged in as a restricted user. This can come in handy because then you can run many programs in restricted mode without re-login in as Administrator. Of course there is the Runas menu for executables, but you don't get it for Folders and directories.

What you have to do is simple. Copy and paste the following code in to notepad and save the resulting file in any name of ".reg" extension.
E.g. RootConsole.reg Then do a one time login as Administrator and double click the newly created .reg file. If all goes well, you should see a Shortcut called "Open Root Console Here" when you right click a Directory or Drive. When selected, it should ask you for the administrator password, and open up a Admin Console for you in the selected directory.

Note. You will have to replace COMPUTER_NAME with your computer name, and AdministratorName with your administrator account name.
E.G. My Computer name was Laptop
My administrator name was Administrator

Below is the reg file contents

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd_root]
@="Open Root …
WolfPack 491 Posting Virtuoso Team Colleague

Missed another one. You can't call non-static member functions like that. So change it to static.
<<<<<<<<<<Class.h>>>>>>>>>>

#pragma once
class Class
{
public:
    int get_return(int a,int b,int (*compare)(int, int));
    static int Rxgmoral(int a,int b);
    void Fun();
};

<<<<<<<<<Class.Cpp>>>>>>>>

#include "Stdafx.h"
#include "Class.h"
int Class::get_return(int a,int b,int(* compare)(int, int))
{
    return (compare(a,b));
}
int Class::Rxgmoral(int a, int b)
{
    return a+b;
}
void Class::Fun()
{
    int a;
    a=get_return(1,2,Class::Rxgmoral);
}
WolfPack 491 Posting Virtuoso Team Colleague

try this
<<<<<<<<<<Class.h>>>>>>>>>>

#pragma once
class Class
{
public:
    int get_return(int a,int b,int (*compare)(int, int));
    int Rxgmoral(int a,int b);
    void Fun();
};

<<<<<<<<<Class.Cpp>>>>>>>>

#include "Stdafx.h"
#include "Class.h"
int Class::get_return(int a,int b,int(* compare)(int, int))
{
    return (compare(a,b));
}
int Class::Rxgmoral(int a, int b)
{
    return a+b;
}
void Class::Fun()
{
    int a;
    a=get_return(1,2,Rxgmoral);
}
WolfPack 491 Posting Virtuoso Team Colleague

What a strange message. :confused:

WolfPack 491 Posting Virtuoso Team Colleague

You can create a class in C, but the language does not provide the syntax in the way that you are implying/asking.

oh. How do you do that?

WolfPack 491 Posting Virtuoso Team Colleague

Please format your code properly.

  • Increase the Tab settings
  • put braces even for the places where there is only one statement inside a for loop

When debugging problems, you don't debug all of the functions at once. Check each function one by one. If there is a debugger in your development environment use that. Usually crashes like this are because of array accessing errors like out-of-bound accessing.

Anyway
change this code

randomArray = new int [arraySize];
    sortedArray=new int[arraySize];
    reversedArray=new int[arraySize];
    cout << "Enter the number of elements in the array: "; 
    cin >> arraySize;

like this

cout << "Enter the number of elements in the array: ";     
    cin >> arraySize;
    randomArray = new int [arraySize];
    sortedArray=new int[arraySize];
    reversedArray=new int[arraySize];

you are creating an array of 0 elements and trying to access more than 0 elements. strange that it worked even upto 6400.

WolfPack 491 Posting Virtuoso Team Colleague

This article summarizes why a standard is needed.
Specifically this part.

Impact: The standard will make it easier to teach C++ (which is just coming into use for the Advanced Placement Computer Science courses in US high schools), to use C++ in applications, and to port C++ programs from one kind of computer to another. Basically, the standard heralds a new era of C++ use where more advanced techniques can be used effectively in industrial, research, and educational software. Software tools providers are already shipping C++ implementations and tools that approximate the standard. The standard allows users greater freedom of choice of C++ implementations, allows implementers and major users to check implementations against the standard using test suites and to compare implementations using performance tests. The increased stability and portability offered by the standard is a boon to library providers and tools provides as well as implementers. These improvements will help C++ application developers to build better applications faster, and to maintain them with less cost and effort. The result will be further improvements in the quality of applications delivered to end users - who, typically, will have no idea that they are relying on C++ in their everyday life.

WolfPack 491 Posting Virtuoso Team Colleague

Everything you can do in C++ you can also do in C.

Are you sure? You can create a class in C++. Can you create a class in C also?

WolfPack 491 Posting Virtuoso Team Colleague

I wouldnt just copy somones work cause thats not me ...
thats one of the reasons y i didnt post up the code cause i didnt need someone to solve this for me i just needed a boost in where to look into ...

anyways thx for the info help it def. was alot more then i expected :mrgreen: ...

You've got the correct attitude. :cheesy:

WolfPack 491 Posting Virtuoso Team Colleague

This may not be necessary. If you use the filename *.fil, in the version of Unix I used the command line was expanded to include all .fil files. Then you only have to loop through the command line parameters if Red Hat works the same. Give it a try with something simple:

int main(int ac, char *av[])
{
    int parm=1;
    while (parn < ac)
    {
        puts(av[parm++]);
    }
    return 0;
}

hmm. Cool trick. pity it doesn't work in Windows too. By the way, I think this is a typo. while (par[B]n[/B] < ac) Edit:
Works in Cygwin. That is a consolation. :D

WolfPack 491 Posting Virtuoso Team Colleague

Nobody will help you unless you show what you have done upto now. We do not do others homework.

WolfPack 491 Posting Virtuoso Team Colleague

here is the new code of my running program. i solve it already. thanks to the help of others!! But my code is not that practical to use because i didn't use a loop instead i typed all the needed data one by one in the displayreverse function inorder to display all the data inputted by the user from the last input up to the first input.

But still i'm hoping to run this program using a loop.

By the way, I'm also planning to learn Dev-C++ for me to be able to understand more deeply "C".
Thanks for the advice.:cheesy:

You are welcome.

But still I can't escape in using borland turbo C because this is what we use in our school (subject: CS 211 in our school ).:sad:
"what a crappy school!! right??!!!!":-|:sad:

Yeah school is crappy. But use DevCPP at home. Maybe code that works in DevCPP will work in TurboC, although not the otherway around (not sure about that but stick with code that works in DevCPP as much as possible ). Thank god I didnt learn programming at school :cheesy:

WolfPack 491 Posting Virtuoso Team Colleague

Will this work?

Why don't you try and see?

WolfPack 491 Posting Virtuoso Team Colleague

Why did you post that? Are you having any other problems?

WolfPack 491 Posting Virtuoso Team Colleague

Hi WolfPack,

ok..I've got what do u mean..and I already try it n it works..but..I still need to type the filename right?..If possible, I just want to run program.exe only but then it can read all the files inside the same directory.

I just will run:

program.exe


Thanks...you already help me a lot...your help very much appreciated...

Yes, you still have to type the filename. There is no way to automatically get it done without making the program more complex. The best and easiest way to do is write a Command Script that executes your program for all the datafiles in the folder. What is your operating system?

WolfPack 491 Posting Virtuoso Team Colleague

Change your program like this

int main(int argc, char *argv[])
{
    int i;
    if ( argc == 1 )
    {
            cout << "Enter at least one file name\n";
            return -1;
    }
    for (i = 1; i < argc; i++)
    {
          readLogFile(argv[i]);
     }
    return 0;
}

Now when you Run the program from the command line, type the program name and the filenames like this Program.exe Filename1.txt Filename2.txt ... the files will get processed. I hope that answers your question.

WolfPack 491 Posting Virtuoso Team Colleague

No problem for now. You will lose the checkable range by one number if you later decide to check for more. If you do the - 1, the powers start from 1 , you can go from
1, 2, 4, 8, .... max limit
If you dont do the - 1 the powers start only from 2, you can go from
2, 4, 8, .... You are missing 1 checkable position.
So there is the problem of upgrading the solution. And usually in production code, you will find flags start from 1 and go up from there. Not from 2 to above.

WolfPack 491 Posting Virtuoso Team Colleague

Suppose in the array all 1, 2, 3 and 4 are present now after the operation
l_var = l_var | (int)pow( 2, Array );

= pow( 2, 1) | pow( 2, 2)| pow( 2, 3) | pow( 2, 4)
= 2 | 4 | 8 | 16
= 10 | 100 | 1000 | 10000 (all binary)
= 11110
= 30 (dec)

How did u got 15 ???

Ach. Change it to

l_var = l_var | (int)pow( 2, Array[i] - 1);

so that the result becomes 1 | 2 | 4 | 8 = 15 use code tags next time.

WolfPack 491 Posting Virtuoso Team Colleague

Why 30?

WolfPack 491 Posting Virtuoso Team Colleague

why can't you use

If
Array[i] == 1 || Array[i] == 2 || Array[i] == 3 || Array[i] == 4
then
l_var = l_var | (int)pow( 2, Array[i] );

At the end of the loop check if l_var == 15
If its 15 return true;

WolfPack 491 Posting Virtuoso Team Colleague

contains 1,2,3 or 4.

Should all 1,2,3 and 4 be in the array or is it enough to have only 1 out of those elements?

WolfPack 491 Posting Virtuoso Team Colleague

Oh. Then search for passing Command Line Arguments in C/C++. By using Command Line arguments, you can pass the filename from the command line to your program.
Like this

C:\> YourProgram.exe filename

then you can call this program when you receive the file.

WolfPack 491 Posting Virtuoso Team Colleague

change readLogFile() so that you can pass the filename into it. readLogFile( const char* filename) then you can call readLogFile for any file you want.

readLogFile("file1.txt");
readLogFile("file2.txt");
WolfPack 491 Posting Virtuoso Team Colleague

Try changing this part in displayreverse()

void displayreverse()
{
    int i,p;
    printf(" idno.  lstnme  prelim  midterm  fgrde");
    for(i=4;i>=0;i--);
    {

Please do not use clrscr , and gotoxy . Those functions are not standard functions. Since you are obviously a student, try to learn the correct usage of the C language. Modern compilers which are more standard compilant than TurboC does not compile your program. Search for the DevCPP compiler in google and download it. It is a very good compiler for beginners.

WolfPack 491 Posting Virtuoso Team Colleague

Windows Programming is a bit advanced. Decide yourself if you have a solid programming background. Take a look at this tutorial. See if you understand the code. If you can't understand that code, learn C a bit more. Just being able to compile and execute will not be enough. You should be able to make changes when necessary.

You will probably need to download the Borland 5.5 compiler at the very least.

WolfPack 491 Posting Virtuoso Team Colleague

I'm guessing here, but I recon they cancel each other out.

All directives run on each instance, so:

Preprocessor finds the first instance of a and runs ALL directives on it
a = b = a
Then it finds the first instance of b and applied all directives to it
b = a = b

and so on...

I also think this is the correct interpretation.

-8- A preprocessing directive of the form # define identifier replacement-list new-line
defines an object-like macro that causes each subsequent instance of the macro name* [Footnote: Since, by macro-replacement time, all character literals and string literals are preprocessing tokens, not sequences possibly containing identifier-like subsequences (see 2.1.1.2, translation phases), they are never scanned for macro names or parameters. --- end foonote]to be replaced by the replacement list of preprocessing tokens that constitute the remainder of the directive.* [Footnote: An alternative token (lex.digraph) is not an identifier, even when its spelling consists entirely of letters and underscores. Therefore it is not possible to define a macro whose name is the same as that of an alternative token. --- end foonote]The replacement list is then rescanned for more macro names as specified below.

16.3.4 - Rescanning and further replacement [cpp.rescan]

-1- After all parameters in the replacement list have been substituted, the resulting preprocessing token sequence is rescanned with all subsequent preprocessing tokens of the source file for more macro names to replace.
-2- If the name of the …

WolfPack 491 Posting Virtuoso Team Colleague

Please describe your problem a bit more. What are the errors that you are getting?

WolfPack 491 Posting Virtuoso Team Colleague

int main(int argc, char *argv[0])

That looks strange.

Yes, it should be

int main(int argc, char *argv[])
WolfPack 491 Posting Virtuoso Team Colleague

even if there was a function like is_character_waiting, you will always have to go back and check it's return value. This is like looping back on a blocking function until data is read. So nothing will be achieved. The easiest way is to use a separate thread. Check the Windows API reference for CreateThread or _beginthread. It is not as difficult as it sounds to be. I have heard that beginners find _beginthread easier.

WolfPack 491 Posting Virtuoso Team Colleague

Meanwhile, is there a simple call I can use to form the basis of function bool is_character_waiting( com_port);

Not that I know of. But I always use the File management functions, so I have not looked for anything else.

What function are you using to read the Serial Port now?

WolfPack 491 Posting Virtuoso Team Colleague

Now just to be an ass I'll change my mind and reverse that last statement of mine.

No, not just to be an ass:
http://c-faq.com/expr/seqpoints.html

Snarl.

My question is why? Why is it a curiousity? Why not just write it without ambiguity?

When I write code I try to be clear and without ambiguity. But I can't give a answer like that when a newbie asks something about operator call sequence. So I have to be careful on subtle points like that (especially since I am a mod). I will go through the link and see what I can make out from it. :)

WolfPack 491 Posting Virtuoso Team Colleague

Why don't you create a separate thread to read and wait for data in the COM port? When data is available, you can pass it to the parent process using a callback function. I think that is the easiest. This is called Multi-threaded IO. The thread that you are doing the IO read/write is waiting for the data. But the other threads will continue execution. You do the GUI updates in your main thread and the Port reading in the secondary thread.

There is another method called Overlapped I/O. You do this by setting the overlapped attribute of the file handle that reads the COM port. This is done by specifying the FILE_FLAG_OVERLAPPED flag on the CreateFile or other call that creates the file handle. See the Win32 API function references for CreateFile, ReadFile, WriteFile, and GetOverlappedResult.

WolfPack 491 Posting Virtuoso Team Colleague

Grr.

WolfPack 491 Posting Virtuoso Team Colleague

How would you break down 231 in to 100,50,20,10,5,1.s?
These are the steps.

Divide 237 by 100 . The answer is 2. remainder is 31.
Divide the remainder ( 37 ) by 50. Answer is 0. remainder is 31.
Divide the remainder ( 37 ) by 20. Answer is 1. remainder is 17.
Divide the remainder ( 17 ) by 10. Answer is 1. remainder is 7.
Divide the remainder ( 7 ) by 5. Answer is 1. remainder is 2.
Divide the remainder ( 2 ) by 1. Answer is 2. remainder is 0.

So you draw the flowchart like this.
Step 1: Get next unprocessed element of the set { 100,50,20,10,5,1 }
Step 2: Divide the amount of money from that element.
Step 3: Store quotient ( Q ) and remainder ( R )
Step 4: You need a Q number of the current element
Step 5: If R is not 0, repeat from Step 1: Else Exit

Draw the flowchart for the above steps and you will get your answer.

WolfPack 491 Posting Virtuoso Team Colleague

Hi. This is not a C/C++ related problem. This is most probably regarding a malware problem. I will move this thread to the appropriate section. khost is not an essential process according to the searches I made. You can try the tool that can be downloaded here for free to remove it. The experts in the malware section will advice you further.

WolfPack 491 Posting Virtuoso Team Colleague

I am not a virus expert, and this is not the proper forum. There is an anti virus forum which specifically deals with anti-virus removal. Anyway try downloading this removal tool and see what happens. Probably it should work. If it doesn't, post again in the proper forum.

WolfPack 491 Posting Virtuoso Team Colleague

I know that it is done after the comparison. I wanted to know if it was done after or before the assignment.

WolfPack 491 Posting Virtuoso Team Colleague

So the error was this statement? y=x++<=5; is equivalent to y=(x++<=5); .

WolfPack 491 Posting Virtuoso Team Colleague

If x is less than or equal to 5, y is set to 1 -- otherwise y is set to 0; x is then incremented.

Is x incremented before or after the result of the comparison is assigned to y? Correct me if I am wrong in the explaination below. y=x++<=5; is equivalent to y=(x++<=5); .
The part inside the brackets should be evaluated first. So doesn't that mean the binary comparison and the ++ should also be evaluated before the assignment?

WolfPack 491 Posting Virtuoso Team Colleague

Create a flowchart that inputs an amount and output the denomination breakdown by 100,50,20,10,5,1.
e.g. Amount: 237
Output: there are 2 100 peso
there are 0 50 peso
there are 1 20 peso
there are 1 10 peso
there are 1 5 peso
there are 2 2 peso


Hope you help me... coz i need it asap...
thanks... 2nd yr. IT

Do you really expect us to draw a flowchart for you? No we don't do that.
As for your question, write down the steps you would follow if your were doing in by hand on paper. Then you will have an idea of how to draw the flowchart.

WolfPack 491 Posting Virtuoso Team Colleague

*rolleyes*