GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-Oct-2006, 00:05
naith naith is offline
New Member
 
Join Date: Oct 2006
Posts: 1
naith is on a distinguished road
Post

Creating a Graph Plotter with MFC


I'm writing a program that takes a value in from the user and plots out a sin graph. But I can't seem to get it to do the plotting. I think its taking in the value from the user, but it can't process the value I think. This is the portion of the code that is suppose to plot out the graph:

CPP / C++ / C Code:
void CTemp5View::OnOptionTime() 
{
	// TODO: Add your command handler code here
	CTimeDlg dlg;
	dlg.m_time = X;

	if (dlg.DoModal() == IDOK)
	{
	CPaintDC dc(this); // device context for painting
	
	X = dlg.m_time;
	Y = sin (X);

	CPen PenBlack;
	PenBlack.CreatePen(PS_SOLID, 1, BLACK_PEN);
	dc.SelectObject(&PenBlack);

	XF = (X * 0.72) +40;
	YF = 200 - (Y * 0.0055);

	dc.MoveTo( XF, 200);
	dc.LineTo( XF, YF);
	}
}

Could someone please help me out?
Last edited by LuciWiz : 22-Oct-2006 at 05:35. Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
  #2  
Old 26-Oct-2006, 03:45
Dominic Dominic is offline
Member
 
Join Date: Aug 2005
Posts: 117
Dominic will become famous soon enough

Re: Creating a Graph Plotter with MFC


Just a couple of ideas.
1. The code in the If statement will only be processed once the dialog has been closed (window destroyed). What user input value it may have had is then lost, unless you write a get function to acquire it from the dialog, before the dialog is deleted at the return from the function.

2. I dont see any means of looping through diffent values of amplitude with respect to time. Is this software supposed to be in a loop?
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with graph application linkin CPP / C++ Forum 0 28-Oct-2005 01:42
how to get Call graph for applications, anybody knows bravetanveer C Programming Language 1 29-Sep-2005 23:27
Creating A Graph In C lilmainy C Programming Language 0 20-Apr-2005 10:40
Help creating lists of pointers The_Kingpin C Programming Language 0 11-Dec-2004 13:49
Problem with the function creating updating a linked list nkhambal C Programming Language 3 28-Oct-2004 20:45

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 04:17.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.