Click here to Skip to main content
15,913,055 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionListview with LVS_ICON style Pin
Perspx29-May-07 12:41
Perspx29-May-07 12:41 
AnswerRe: Listview with LVS_ICON style Pin
Naveen29-May-07 15:03
Naveen29-May-07 15:03 
QuestionRedraw a pane splitter window Pin
gurucplusplus29-May-07 12:16
gurucplusplus29-May-07 12:16 
QuestionProblem on examing a String (token from a file) Pin
Immunity1829-May-07 9:39
Immunity1829-May-07 9:39 
QuestionRe: Problem on examing a String (token from a file) Pin
David Crow29-May-07 10:03
David Crow29-May-07 10:03 
AnswerRe: Problem on examing a String (token from a file) Pin
Immunity1829-May-07 20:57
Immunity1829-May-07 20:57 
QuestionRe: Problem on examing a String (token from a file) Pin
David Crow30-May-07 2:41
David Crow30-May-07 2:41 
AnswerRe: Problem on examing a String (token from a file) [modified] Pin
Immunity1830-May-07 2:48
Immunity1830-May-07 2:48 
void CBayesDlg::OnCalc() 
{
	int nStart;
	UpdateData(TRUE);

	nStart = 1;
	if (nStart ==1)
	{
		ReadFileII();


	}
	UpdateData(TRUE);
}

void CBayesDlg::ReadFileII()
{
		double rn = 0;
		double ry = 0;
		CString FilePathName;
		CString LineRead ;
		const int sz =100;
		char buf[sz];
		int rCount = 0;

		CString str;
		FilePathName = m_FilePath;
		ifstream FileText(FilePathName);

		while(FileText.get(buf,sz))
		{
			FileText.get();
			LineRead = (LPCSTR) buf;
			Compare ( LineRead,rCount);
			rCount = rCount +1;
		
		}
		int a=0,b=0,c=0,d=0,e=0,n=0,y = 0;

		for (int i = 0 ; i < (rCount) ; i++)
		{
			if ( m_Array[i][5]== "N" || m_Array[i][5] =="n")
			{
				n = n +1;
				if ( m_Array[i][0] == m_A)
				{
					a = a+1;
				}
				else if ( m_Array[i][1] == m_B)
				{
					b = b+1;
				}
				else if (m_Array[i][2] == m_C)
				{
					c = c +1;
				}
				else if (m_Array[i][3] == m_D)
				{
					d = d +1;
				}
				else if (m_Array[i][4] ==m_E)
				{
					e = e +1;
				}
			}
		}
		if ( rCount && n != 0 )
		{
			rn = (double) (n/rCount)*(a/n)*(b/n)*(c/n)*(d/n)*(e/n);
		}
		else 
		{
			rn = 0;
		}
		
		if ( rn > ry)
		{
			m_R = "NO";
		}
		else if (ry > rn)
		{
			m_R = "YES";
		}

		FileText.close;	

}

void CBayesDlg::Compare(CString line, int y)
{
		int v = 0;
		CString word;
		CString tab = "\t";
		int x = line.GetLength();
		for (int i = 0 ; i < x ; i ++ )
		{
			if ( i==0)
			{
				word = line.GetAt(i);
			}
			else if ( i>0 )
			{
				if ( line.GetAt(i) != tab)
				{
					word = word + line.GetAt(i);
				}
				else if (line.GetAt(i) == tab)
				{
					m_Array[y][v] = word;
					word.Empty();
					v = v +1;
				}
				
			}
			else if (i == (x -1))
			{
				m_Array[y][5] = line.GetAt(i);
			}

		}

}



-- modified at 8:56 Wednesday 30th May, 2007
QuestionRe: Problem on examing a String (token from a file) Pin
David Crow30-May-07 3:18
David Crow30-May-07 3:18 
AnswerRe: Problem on examing a String (token from a file) Pin
Immunity1830-May-07 3:19
Immunity1830-May-07 3:19 
GeneralRe: Problem on examing a String (token from a file) Pin
David Crow30-May-07 3:23
David Crow30-May-07 3:23 
GeneralRe: Problem on examing a String (token from a file) Pin
Immunity1830-May-07 3:24
Immunity1830-May-07 3:24 
GeneralRe: Problem on examing a String (token from a file) Pin
Immunity1830-May-07 3:25
Immunity1830-May-07 3:25 
GeneralRe: Problem on examing a String (token from a file) Pin
David Crow30-May-07 3:29
David Crow30-May-07 3:29 
GeneralRe: Problem on examing a String (token from a file) Pin
Immunity1830-May-07 3:41
Immunity1830-May-07 3:41 
QuestionChange MFC Dialog name (when running) Pin
Johpoke29-May-07 9:26
Johpoke29-May-07 9:26 
AnswerRe: Change MFC Dialog name (when running) Pin
shiraztk29-May-07 9:52
shiraztk29-May-07 9:52 
AnswerRe: Change MFC Dialog name (when running) (solved) Pin
Johpoke29-May-07 20:06
Johpoke29-May-07 20:06 
QuestionQuestion about Creating Directshow Filter with a callback Pin
godspeed12329-May-07 8:29
godspeed12329-May-07 8:29 
AnswerRe: Question about Creating Directshow Filter with a callback Pin
Mark Salsbery29-May-07 9:03
Mark Salsbery29-May-07 9:03 
GeneralRe: Question about Creating Directshow Filter with a callback Pin
godspeed12329-May-07 10:42
godspeed12329-May-07 10:42 
GeneralRe: Question about Creating Directshow Filter with a callback Pin
Mark Salsbery29-May-07 13:27
Mark Salsbery29-May-07 13:27 
GeneralRe: Question about Creating Directshow Filter with a callback Pin
godspeed12330-May-07 7:13
godspeed12330-May-07 7:13 
GeneralRe: Question about Creating Directshow Filter with a callback Pin
Mark Salsbery30-May-07 7:27
Mark Salsbery30-May-07 7:27 
GeneralRe: Question about Creating Directshow Filter with a callback Pin
godspeed12330-May-07 7:35
godspeed12330-May-07 7:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.