|
Semion_N wrote: I just know how to add points to the board
You didn't even get that right...
An element is not a data point, it's a data set. If you only have one data set, which you do, you are supposed to just m_Graph.PlotXY(x,y,0);
|
|
|
|
|
You mean that when I'm adding element so its not a point it can be a line too?
but how can I use the line and not the point-you wrote this m_Graph.PlotXY(x,y,0);
I used it but as a point draw.
How can I make lines?
SnaidiS(Semion)
|
|
|
|
|
From the article...
m_Graph.SetElementLineColor(RGB(255,0,0));
m_Graph.SetElementLinetype(0);
m_Graph.SetElementWidth(1);
|
|
|
|
|
Yes-I tri9ed this option but when I'm typing it here for instance:
<br />
void CGraphsXYAxisDlg::OnBnClickedButton2()<br />
{<br />
UpdateData(TRUE);<br />
m_Graph.AddElement();<br />
m_Graph.SetElementWidth(10);<br />
m_Graph.PlotXY(X,m_Y,X);<br />
X++;<br />
m_Graph.SetElementLineColor(RGB(0,0,0));<br />
m_Graph.SetElementLinetype(0);<br />
m_Graph.SetElementWidth(1);<br />
}<br />
The program do nothing it dont draw even only the points...
TY!
SnaidiS(Semion)
|
|
|
|
|
You don't seem to understand my previous message. An element is NOT a data point. An element contains a set of data points along with the parameters of how to draw the data set. Lets say I would like to plot the stock market performance of a few companies, the performance data of Yahoo would be one element and the performance data of Google would be another element. So I have 2 elements. I can set the color for Yahoo to be yellow and the color for Google to be blue.
<br />
void CGraphsXYAxisDlg::OnBnClickedButton2()<br />
{<br />
UpdateData(TRUE);<br />
m_Graph.AddElement();<br />
m_Graph.SetElementWidth(10);<br />
m_Graph.PlotXY(X,m_Y,X);<br />
m_Graph.PlotXY(X,m_Y,0);<br />
X++;<br />
}<br />
If it still doesn't work, set a breakpoint at the PlotElement() function in NTGraphCtl.cpp and see why it's not drawing the line.
|
|
|
|
|
Yes it works!!
First of all-thank you!
but I don't understand- an element contains number of points,so why don't you add elements here?
and then draw them?
I don't really understand why PlotXY draws a set of point if you give to this function only one point?
SnaidiS(Semion)
|
|
|
|
|
By default the graph starts with one element. It is reasonable to assume that you must at least have one data set if you want to plot a graph.
PlotXY doesn't draw anything. The element contains an array of points, PlotXY simply adds a point to the array. When there's a WM_PAINT message, the control iterates thru each element and draws all the points based on the per element settings.
|
|
|
|
|
OK I understoon TY but PlotXY adds into the array only one point on each button press in my case so why does it draws a line and not point?
SnaidiS(Semion)
|
|
|
|
|
I don't get the question. With 2 points you can draw a line.
|
|
|
|
|
yeah... you are right!
Thank you man! you helped me alot!
SnaidiS(Semion)
|
|
|
|
|
class RTI_EXPORT RTIambassador {<br />
public:<br />
#include "RTIambServices.hh"<br />
RTIambPrivateData* privateData;<br />
private:<br />
RTIambPrivateRefs* privateRefs;<br />
};
I didn't know the meaning of having two names beside the name Class like this:
class RTI_EXPORT RTIambassador
Someone gave me an answering saying the class is intended to be exported from a DLL.
What is meant by a class being exported from a DLL. Does this mean that this specific code here is a a little chunk of a code from a DLL file and is being used by the current file Im working with? Or does it mean, tell the DLL linker to add this specific class onto the linker as an addition function.
I'm very confused here. Someone help me out. Thanks in advance
PS: I've already posted this before. Sorry for posting it again but I haven't got much reply. I beleive its because of the time I posted. Hope someone can help me out
Cheers,
Jay -
|
|
|
|
|
Jay03 wrote: class RTI_EXPORT RTIambassador
RTI_EXPORT is a preprocessor macro. When dealing with DLLs, there are some compiler directives you can use (instread of having *.def files) to say you are exporting (or importing) classes, variables, functions, etc. If you do a search for RTI_EXPORT, you should find it defined something like the following:
#ifdef _WINDLL
#define RTI_EXPORT __declspec(dllexport)
#else
#define RTI_EXPORT __declspec(dllimport)
#endif
What that does is allow the you to compile the DLL stating that this class is being exported while you can use the same header file in the application and state that the class is being imported.
Now, when writing DLLs for Windows applications (as opposed to so's for *Nix systems), you have to tell the compiler which symbols (variables, functions, classes, etc) are being exposed to be used by anyone wishing to use the library. At the same time, when you write an application that needs to use a DLL, you need to know which symbols are being imported so the linker knows what to do with them.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hello,
I need some help with some data validation as I'm not much of a programmer. I have created some string and character variables in a simple program I am writing for my company. Specifically, the program is suppose to accept user input from the keyboard and check to verify if the user enters data or enters nothing.
At the moment, I would like to give the user the option to press the enter key if they choose to skip data entry for a particular variable and go on to key in data for the next variable using the getline() input function.
Right now, the program forces the user to enter data for all variables. Simply hitting the enter key will not allow the user to move on in the program. The prompt just sits there waiting for your input for the current variable. Is there a way to force the program to move ahead in the program?
My next question is how to represent NULL for data that was never entered.
Help is much appreciated.
Thanks, HRW
|
|
|
|
|
What code do you have for this currently? If you are using something like (pseudo-code):
while (INeedData())
{
string data;
cin >> data;
}
Then you won't be able to skip. If you do something like:
while (INeedData())
{
string data;
cin.getline(data, "\n");
}
Enter will allow you to skip.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hello,
I am using something like to following:
string data2;
cout << "Please enter modifications if any: ";
cin >> data2;
I am studying the pseudo code but I do not quite understand the test condition while (INeedData()). If the user preforms the entry, then I would like to store that data in the assigned variable. But if the user types in a carriage return, I would like to bypass this variable storage or at least assign it a NULL value it that is at all possible. I tried to use the isspace() function but that has not worked for me.
Thanks for the above reply. HRW
|
|
|
|
|
That was just defining a loop to show that this operation would be done multiple times. Judging from your response, I imagine your code looks more like this:
string data1;
cout << "Enter Data1: ";
cin >> data1;
string data2;
cout << "Enter Data2: ";
cin >> data2;
string data3;
cout << "Enter Data3: ";
cin >> data3;
...
cin ignores whitespace. To get the behavior you want, you need to do something like this instead:
char buffer[256] = {0};
string data1;
cout << "Enter Data1: ";
cin.getline(buffer, 255, '\n');
data1 = buffer;
memset(buffer, 0, 256);
string data2;
cout << "Enter Data2: ";
cin.getline(buffer, 255, '\n');
data2 = buffer;
memset(buffer, 0, 256);
string data3;
cout << "Enter Data3: ";
cin.getline(buffer, 255, '\n');
data3 = buffer;
memset(buffer, 0, 256);
...
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hello,
I created a character array as you have above. I assigned it to each of my input statements with no trouble at all. It works perfectly. I am curious as to the purpose of the memset function. I would assume it re-initializes buffer to 0.
Thanks
HRW
|
|
|
|
|
Harold_Wishes wrote: I am curious as to the purpose of the memset function. I would assume it re-initializes buffer to 0.
Yes. Calling it just goes through and makes sure that every character in the buffer is set to 0 before pulling in more input.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hello again,
I did run my program and caught a runtime error with the cin.getline(buffer, 500, '\n'); I have a condensed working version below of the program compiled using Visual C++. One of my cin input streams is not being read in. It is skipped automatically and just goes to the next input prompt. I have not been able to figure out why this is happening.
I have 2 functions in main(). The problem seems to be when I move from function 1 to function 2 (the runtime error occurs in function 2). Oddly enough, the problem disappears when I comment out function 1 and only execute function 2. If you have a complier and execute the program (at least with Visual C++), you may see what I mean.
Regards
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cctype>
#include <iomanip>
#include "unsortedlist.h"
#include "sortedlist.h"
using std::string;
using namespace std;
struct node
{
string Length;
string Sequence;
string N_Terminal;
string C_Terminal;
node *nxt;
};
node *start_ptr = NULL;
node *current;
void add_Part_one (string& data1, int& data2)
{
string selection = "A";
cout << "Please Select the sequence type: " << endl;
cout << endl;
cout << "A) Complete B) Partial C) UNKNOWN" << endl;
cin >> selection;
while (selection != "A" && selection != "a" && selection != "B" && selection != "b"
&& selection != "C" && selection != "c")
{
cout << "Invalid Entry. Please Try Again: " << endl;
cin >> selection;
}
if ( selection == "A" || selection == "a" )
{
data1 = "Complete";
}
else
if ( selection == "B" || selection == "b" )
{
data1 = "Partial";
}
else
if ( selection == "C" || selection == "c" )
{
data1 = "UNKNOWN";
}
cout << "Please enter the number of subunits: ";
cin >> data2;
}
void add_node_at_end()
{
node *temp, *temp2;
temp = new node;
char buffer[501] = {0};
cout << "Please enter the length of the protein sequence: ";
cin.getline(buffer, 500, '\n');
temp->Length = buffer;
memset(buffer, 0, 501);
cout << "Please enter the protein sequence : ";
cin.getline(buffer, 500, '\n');
temp->Sequence = buffer;
memset(buffer, 0, 501);
cout << "Enter brief status on the presence of a modified N_Terminal: ";
cin.getline(buffer, 500, '\n');
temp->N_Terminal = buffer;
memset(buffer, 0, 501);
cout << "Enter brief status on the presence of a modified C_Terminal: ";
cin.getline(buffer, 500, '\n');
temp->C_Terminal = buffer;
memset(buffer, 0, 501);
temp->nxt = NULL;
if (start_ptr == NULL)
{ start_ptr = temp;
current = start_ptr;
}
else
{ temp2 = start_ptr;
while (temp2->nxt != NULL)
{ temp2 = temp2->nxt;
}
temp2->nxt = temp;
}
cout << endl;
}
int main()
{
int number_of_subunits = 1;
string SEQUENCE_TYPE;
add_Part_one(SEQUENCE_TYPE, number_of_subunits);
for (int counter = 0; counter < number_of_subunits; counter++)
{
add_node_at_end();
}
return 0;
}
HRW
|
|
|
|
|
Try this:
#include <string>
#include <list>
#include <iostream>
using namespace std;
struct data
{
string Length;
string Sequence;
string N_Terminal;
string C_Terminal;
};
list<data> g_DataList;
char selectionMenu()
{
char selection = 0;
cout << "Please Select the sequence type: " << endl;
cout << endl;
cout << "A) Complete B) Partial C) UNKNOWN" << endl;
cin >> selection;
return selection;
}
bool isValidSelection(char selection)
{
switch (selection)
{
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
return true;
default:
return false;
}
}
string getSelectionString(char selection)
{
string result = "UNKNOWN";
switch (selection)
{
case 'A':
case 'a':
result = "Complete";
break;
case 'B':
case 'b':
result = "Partial";
break;
}
return result;
}
void add_Part_one (string& data1, int& data2)
{
char selection = 0;
do
{
selection = selectionMenu();
} while (!isValidSelection(selection));
data1 = getSelectionString(selection);
char buffer[100] = {0};
cout << "Please enter the number of subunits: ";
cin >> data2;
cin.getline(buffer, 99, '\n');
}
void add_node_at_end()
{
data temp;
char buffer[501] = {0};
cout << "Please enter the length of the protein sequence: ";
cin.getline(buffer, 500, '\n');
temp.Length = buffer;
memset(buffer, 0, 501);
cout << "Please enter the protein sequence : ";
cin.getline(buffer, 500, '\n');
temp.Sequence = buffer;
memset(buffer, 0, 501);
cout << "Enter brief status on the presence of a modified N_Terminal: ";
cin.getline(buffer, 500, '\n');
temp.N_Terminal = buffer;
memset(buffer, 0, 501);
cout << "Enter brief status on the presence of a modified C_Terminal: ";
cin.getline(buffer, 500, '\n');
temp.C_Terminal = buffer;
memset(buffer, 0, 501);
g_DataList.push_back(temp);
cout << endl;
}
int main()
{
int number_of_subunits = 1;
string sequenceType;
add_Part_one(sequenceType, number_of_subunits);
for (int counter = 0; counter < number_of_subunits; counter++)
{
add_node_at_end();
}
return 0;
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
-- modified at 16:36 Friday 7th July, 2006
|
|
|
|
|
Thanks for the assistance.
One last question:
Will I need to overload the << operator to output each element of the data object to the screen?
I am having trouble using the iterator function for the <list> class when I attempt to print the Length, Sequence, N_Terminal and C_Terminal.
Regards
HRW
-- modified at 23:37 Saturday 8th July, 2006
|
|
|
|
|
Harold_Wishes wrote: Will I need to overload the << operator to output each element of the data object to the screen?
You don't need to per se, but you could. Either way, you should create a print method that looks like either of the following:
ostream& operator<<(ostream& os, const data& dta)
{
os << dta.Length.c_str() << endl
<< dta.Sequence.c_str() << endl
<< dta.N_Terminal.c_str() << endl
<< dta.C_Terminal.c_str() << endl;
return os;
}
void print(const data& dta)
{
cout << dta.Length.c_str() << endl
<< dta.Sequence.c_str() << endl
<< dta.N_Terminal.c_str() << endl
<< dta.C_Terminal.c_str() << endl << endl;
}
void print(const data& dta)
{
cout << dta << endl;
}
for_each(g_DataList.begin(), g_DataList.end(), print);
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi,
my email sending with Simple MAPI works, sort of.
But send mail is stuck in the outlook outbox
and has to be mailed from there..
I have looked the examples in here, haven't
found a clue for this problem.
I have also tried the trick, where I send the
mail in first session and then make a second
session with MAPI_FORCE_DOWNLOAD on, but that
doesn't help either.
Any ideas?
|
|
|
|
|
Hy, I have this code and this error which I don't understand. Any help will be very apreciated. Thank you.
this is test1.cpp:
#include <iostream.h>
class Address
{
private:
int house;
int block;
public:
Address(int i, int j) {
house=i;
block=j;
}
friend ostream& operator << (ostream&, const Address&);
};
ostream& operator << (ostream& a, const Address& b)
{
a<<"House No "<
|
|
|
|
|
I suppose you have to move your implementation of operator << to test1.cpp (or other *.cpp) file.
I hope it helps.
-- modified at 10:56 Friday 7th July, 2006
|
|
|
|
|