
Please do help me...pls do guide me





snoop82 wrote: pls do guide me
This[^] is the first step. Once you apply everything that is there, some people might help you. Until then, well, I don't think a lot of people would like to read all your code...





On top of that, this reeks of homework.





didn't i tell you you were a stupid idiot ?
well, i believe you'll trust me now when i give you posting advices.
otherwise, never forget i'll always be beyind your butt to kick you every time you'll abuse the forums





Is anybody familiar with SQLPassThrough? Is this just an old VB way of doing things, or does it also exist through VC++? If it isn't in VC++ what would the equivalent be?





I'm not sure if this is what you're referring to, but it seems this is related to direct
queries to a database, bypassing ODBC.
If so...
In the MFC ODBC classes, there's CDatabase::ExecuteSQL() and CRecordset::Open() with the executeDirect option.
For ODBC using the ODBC APIs, there's SQLExecDirect().
Mark
Mark Salsbery
Microsoft MVP  Visual C++





I'm writing a logging program for virtual COM port connected sensors which is later on going to communicate with a framegrabber for syncronisations purposes. For simplicity I wanted to run the program in a command window but MFC and iostream seems to have a hard time cooperating. I need access virtual serial ports and later on threading for the framegrabber (video input).
First: Is it a dead end to use iostream and a command window for my needs? Do the MFC components refuse running in a command window?
Second: If iostream and MFC should work together (I don't have any previous experience with MFC so I barely know what I'm speaking about) how do I get around my linking problems? I get the evil LNK2005 error, eg.:
nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in libcpmt.lib(newop.obj)
when I'm linking. It seems to be the "new" and "delete" operators which are the problem. I've already looked through the MS article on the topic (ID : 148652) but I still can't figure out how to get around it.
#include <afx.h>
#include <iostream>
,plus an almost empty main, gives me the error. What have I gotten wrong?
I'm using MS Visual Studio .NET 2003.





xjonil wrote: Second: If iostream and MFC should work together
They do. In dayly work with VS.NET 2003 and 2005.
I include the STLstuff in stdafx.h, before including the MFCstuff and there is no linker problem.
Please do a minimal testprogram showing your problems and post it.
Are you perchance using new for a global static variable?
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words





I'm at home now but I think it all boiled down to:
#include <afx.h>
#include <iostream>
void main()
{
std::cout << "test";
};
Now when I think about it I guess afx.h is a litte overkill. I got stuck on the solution proposed in the MS article. I used more specific include files like winbase.h to start with. I'm not sure if it caused the same problem.





Why don't you create a new console project and select MFC support, will that not fix the problem? Then you can diff to see what you're missing???
I got my to work just fine.

Yours Truly, The One and Only!
devmentor.org
Design, Code, Test, Debug





Thanks alot!
I did get it to work but I still cannot figure out what the difference is. That was about what I started with. I guess I have to scrutinize every single character to see if I can produce the same error.





why don't you use a diff tool like windiff to find out what it different from you project (.vcprof) file and the one produced by with Wizard..will be a lot faster!!!

Yours Truly, The One and Only!
devmentor.org
Design, Code, Test, Debug





Using GDI+, Visual C++ 2003.
When using the PenAlignment enumeration type to set line alignment before a drawing primitive like rect, or ellipse, it draws the outline etiher inset or centered on the outline boundary.
This works great for rectangles and ellipses with solid outlines.
However, I'm finding that when I draw rects or Ellipses with outline styles equivalent dashed or dotted with the alignment set to PenAlignmentInset, the results are horrible globs instead of the nice and neat dots and dashes when the alignment is set to PenAlignmentCenter.
typedef enum {
PenAlignmentCenter = 0,
PenAlignmentInset = 1
} PenAlignment;
MSDN states "If you set the alignment of a Pen object to PenAlignmentInset, you cannot use that pen to draw compound lines or triangular dash caps."
My guess is this refers to my issue but I'm not sure this is refering to a rect or ellipse primitive. If it is, problem identified. However, I thought I'd ask the opinion of the rest of you if your interpretation of the above MSDN statement refers to rects and ellipses.
Thanks in advance for opinions.





bob16972 wrote: MSDN states "If you set the alignment of a Pen object to PenAlignmentInset, you cannot use that pen to draw compound lines or triangular dash caps."
From reading the documentation, all it means is that to align "Inset", you have to draw something that has an inside and an outside. It seems to me that rects and elipses should work fine with that alignment.
Nathan





Nathan Holt at EMOM wrote: It seems to me that rects and elipses should work fine with that alignment
Unfortunately, the dots and dashes are disfigured blobs with inset. It's not nearly as noticeable with Ellipse and dash since one of the distortions is a kind've curving and it happens to distort in the same direction as the curve. However, an Ellipse with dot exhibits the distortion in a very obvious way.
With rects, it's easy to identify with dashes or dots.





can anyone tell about the difference between rs232 and rs422 in detail please..
thanks in advance
regards
sudhakar





RS422 uses differential signaling so one is not dependent on a common earth. It makes the signal less sensitive to noice and capacitance and inductivity problems which allow for higher baudrates. I don't know the exakt charachterisitcs of the signal that's being sent.






Hi,
How to calculate Months & Days difference between given two dates? Is there function like DateDiff in C++?
Thanks in Advance,
R
R





From MSDN 
To calculate elapsed time
Use the CTime and CTimeSpan objects to calculate the elapsed time, as follows:
CTime startTime = CTime::GetCurrentTime();
// ... perform timeconsuming task ...
CTime endTime = CTime::GetCurrentTime();
CTimeSpan elapsedTime = endTime  startTime;
Once you have calculated elapsedTime, you can use the member functions of CTimeSpan to extract the components of the elapsedtime value.





COleDateTime::operator +, 
This might be useful.
Disclaimer: I've never used it but it appears to claim to do what your asking.





dear profesional over here...please help me with this problem,i have been trying to solve this problem for pass few hours..and i am still a beginner but the task given to me was too tough for me..
this program has 3 errors..i am halfway stuck please help me..
below is da task given to me..please help and do explain me my mistake.
i want to improve..
Create several files of integers to be used to test sorting methods. Make files of several sizes, for example, size 20, 200, and 2000. Make files that are in order, in reverse order, in random order, and partially in order. By keeping all this test data in files (rather than generating it with random numbers each time the program is run), the same data can be used to test different sorting methods, and hence it will be easier to compare their performance.
Write a menudriven program for testing various sorting methods. One option is to read a file of integers into a list. Other options will be to run one of various sorting methods on the list, to print the unsorted or the sorted list, and to quit. After the list is sorted and (optionally) printed, it should be discarded so that testing a later testing method will start with the same input data. Write the program such that each new sorting method will process the original input file.
Include code in the program to calculate and print
a. CPU time
b. The number of comparisons of keys.
c. The number of assignments of list entries during sorting a list.
Counting comparisons and assignments requires setting up global variables and inserting code into each sorting procedure to increment one of these global variables each time a key comparison and entry assignment is made.
#include <iostream><br />
#include<iomanip.h><br />
#include<math.h><br />
#include <ctime><br />
#include <cstdlib><br />
#include <math.h><br />
int com,call,move;<br />
#define MAX 10<br />
int array[1000];<br />
int arr[], n;<br />
<br />
<br />
<br />
void insertionsort(int array[], int size);<br />
int count1,count2;<br />
void merge(int array[],int first,int mid,int last);<br />
void mergesort(int array[],int first,int last);<br />
void random(int sizeofarray);<br />
void partial(int sizeofarray);<br />
void sorted(int sizeofarray);<br />
void inverse(int sizeofarray);<br />
void insertion();<br />
void random(int sizeofarray)<br />
{<br />
srand(time(NULL));<br />
for (int i = 1 ; i <= sizeofarray ; i++)<br />
{<br />
array[i]=rand();<br />
cout<<array[i]<<endl;<br />
<br />
}<br />
<br />
}<br />
<br />
void inverse(int sizeofarray)<br />
{<br />
for(int i = sizeofarray ; i >= 1 ; i)<br />
{<br />
array[i]=i;<br />
cout<<array[i]<<endl;<br />
}<br />
}<br />
<br />
void sorted(int sizeofarray)<br />
{<br />
for (int i = 1 ; i <= sizeofarray ; i++)<br />
{<br />
array[i]=i;<br />
cout<<array[i]<<endl;<br />
}<br />
}<br />
<br />
void partial(int sizeofarray)<br />
{<br />
for (int i = 1 ; i <= sizeofarray5 ; i++)<br />
{<br />
array[i]=i;<br />
cout<<array[i]<<endl;<br />
}<br />
for ( i = 10 ; i >= sizeofarray5 ; i)<br />
{<br />
array[i]=i;<br />
cout<<array[i]<<endl;<br />
}<br />
}<br />
<br />
<br />
<br />
<br />
<br />
void merge(int array[],int first,int mid,int last)<br />
{<br />
int temp[1000];<br />
int first1 = first;<br />
int last1 = mid;<br />
int first2 = mid + 1;<br />
int last2 = last;<br />
<br />
int index = first1;<br />
<br />
for (;(first1 <= last1) && (first2 <= last2); ++index)<br />
{<br />
if (array[first1] < array[first2])<br />
{<br />
temp[index] = array[first1];<br />
++first1;<br />
com++;<br />
}<br />
else<br />
{<br />
temp[index] = array[first2];<br />
++first2;<br />
com++;<br />
}<br />
}<br />
<br />
<br />
<br />
<br />
for (; first1 <= last1 ; ++first1 , ++index)<br />
{<br />
temp[index] = array[first1];<br />
move++;<br />
}<br />
for (; first2 <= last2 ; ++first2 , ++index)<br />
{<br />
temp[index] = array[first2];<br />
move++;<br />
}<br />
<br />
<br />
for( index = first ; index <= last ; ++index)<br />
{ <br />
array[index]=temp[index];<br />
move++;<br />
}<br />
<br />
}<br />
void mergesort(int array[],int first,int last)<br />
<br />
{<br />
if (first < last)<br />
{<br />
int mid= (first + last)/2;<br />
mergesort(array,first,mid);<br />
mergesort(array,mid+1,last);<br />
call++;<br />
merge(array,first,mid,last);<br />
}<br />
}<br />
<br />
void insertionSort()<br />
{<br />
arr[MAX],n;<br />
<br />
void getdata();<br />
void showdata();<br />
int sortLogic(int d[], int n2);<br />
};<br />
<br />
void sortLogic(int data[], int n)<br />
{<br />
for (int i=1, j; i<n; i++)<br />
{<br />
int tmp = data[i];<br />
for (j=i; j>0 && tmp<data[j1]; j)<br />
data[j] = data[j1];<br />
data[j] = tmp;<br />
}<br />
<br />
}<br />
<br />
<br />
void getdata()<br />
{<br />
<br />
cout<<"How many elements you require: ";<br />
<br />
cout<<"Enter the elements of your array: ";<br />
cin>>n;<br />
for (int i=0; i<n; i++)<br />
cin>>arr[i];<br />
sortLogic(arr,n);<br />
}<br />
<br />
void showdata()<br />
{ <br />
cout<<"\nDisplay\n";<br />
for (int i=0; i<n; i++)<br />
cout<<arr[i]<<" ";<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
void main()<br />
<br />
{<br />
int i;<br />
int n=0;<br />
double number;<br />
int level;<br />
int sizeofarray;<br />
int operation;<br />
int function;<br />
int type;<br />
int choices;<br />
int choices1;<br />
int choices2;<br />
<br />
top:<br />
<br />
cout<<"Welcome to my program assignment 1"<<endl;<br />
cout<<""<<endl;<br />
cout<<"Please choose the type of sorting you would like to use:"<<endl;<br />
cout<<""<<endl;<br />
cin>>choices;<br />
<br />
switch(choices)<br />
{<br />
case 1:<br />
insertionSort();<br />
break;<br />
case 2:<br />
mergesort(array,0,n);<br />
break;<br />
<br />
default:<br />
cout<<"Please enter either one of the number only"<<endl<<endl;<br />
goto top;<br />
<br />
<br />
cout<<"Enter the number of array size you wish to create : ";<br />
cin>>sizeofarray;<br />
cout<<"Your array size now is "<<sizeofarray<<endl<<endl;<br />
cout<<"Now select which one fuction you want to sort !"<<endl;<br />
cout<<"1) for using Random Array."<<endl;<br />
cout<<"2) for using Partially Sorted Array."<<endl;<br />
cout<<"3) for using Sorted Array."<<endl;<br />
cout<<"4) for using Inversely Sorted Array."<<endl<<endl;<br />
cout<<"Your choice is ";<br />
cin>>function;<br />
cout<<endl;<br />
<br />
switch(function)<br />
{<br />
case 1:<br />
random(sizeofarray);<br />
break;<br />
case 2:<br />
partial(sizeofarray);<br />
break; <br />
case 3:<br />
sorted(sizeofarray);<br />
break;<br />
case 4:<br />
inverse(sizeofarray);<br />
break;<br />
<br />
default:<br />
cout<<"Please enter the any above number only!"<<endl<<endl;<br />
goto top;<br />
break;<br />
}<br />
<br />
int first=0;<br />
int last=sizeofarray1;<br />
mergesort( array,first,last);<br />
cout<<endl<<"The above array is Unsorted Array :"<<endl;<br />
<br />
cout<<endl<<"The Sorted Array is show as below :"<<endl<<endl;<br />
for ( i=1 ; i <= sizeofarray ; i++)<br />
{<br />
cout<<array[i]<<endl; <br />
}<br />
<br />
for (n=0;n<20 && number<=sizeofarray ;n++)<br />
{<br />
number=pow(2,n);<br />
}<br />
level=n2;<br />
operation=3*count11;<br />
cout<<endl<<"The total level is : "<<level<<endl;<br />
cout<<"The total number of comparisons is : "<<com<<endl;<br />
cout<<"The total number of move is : "<<move<<endl;<br />
}<br />
<br />
}<br />
<br />
<br />
<br />





The same question was posted by another user a few posts ago.
Can you ask your teacher not to give out this forum's URL as a training assistant?
Homework questions are there to test knowledge you should already have been given in your class.
Iain.





not given any lecture about this...i am not asking to do the coding for me..atleast help me out with some solution...i m willing to do n learn my own...





makaveli_07 wrote: i am still a beginner but the task given to me was too tough for me..
So why not do the logical thing and start with a less ambitious project? Sorting data structures is not a beginner's project.
makaveli_07 wrote: below is da task given to me..
Yes, we know. Please tell your instructor that you are not ready for it just yet.
"A good athlete is the result of a good and worthy opponent."  David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners."  Laurence Sterne




