| | |
Variable problem..
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 11
Reputation:
Solved Threads: 0
Can i know what's wrong with the below source code? can i put the variable x, y like this? How it can't work?
c++ Syntax (Toggle Plain Text)
#include <Windows.h> #include <mmsystem.h> #pragma comment (lib,"winmm.lib") int ,x,y; void CTestingDlg::OnPlay() { // TODO: Add your control notification handler code here UpdateData(TRUE); CString strFreq; CString strHL; strFreq = m_strFreq; strHL = m_strHL; strFreq.MakeUpper(); strHL.MakeUpper(); if(strFreq=="x" && strHL=="y") PlaySound("x_y_2.wav",NULL,SND_FILENAME); }
Last edited by Ancient Dragon; Dec 7th, 2007 at 7:33 am. Reason: add code tags
what makes you think you can compare integers and strings ? Ain't going to work. If the strings contain numeric digits then convert them to integers before doing the comparison.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Are you new to c and c++ languages? You are asking a 1st semester student type of question. If you are then attempting to write an MFC program is way beyond your current level of knowledge. Get an introduction to computer programming book and start studying from page 1. Then in a year or so you will be ready for that MFC program.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
•
•
Can i know what's wrong with the below source code? can i put the variable x, y like this? How it can't work?
c++ Syntax (Toggle Plain Text)
#include <Windows.h> #include <mmsystem.h> #pragma comment (lib,"winmm.lib") int ,x,y; void CTestingDlg::OnPlay() { // TODO: Add your control notification handler code here UpdateData(TRUE); CString strFreq; CString strHL; strFreq = m_strFreq; strHL = m_strHL; strFreq.MakeUpper(); strHL.MakeUpper(); if(strFreq=="x" && strHL=="y") PlaySound("x_y_2.wav",NULL,SND_FILENAME); }
a ) CString to int :
CString csNumber = "3";
int x;
x = atoi(csNumber); //defined in <cstdlib>
b) int to CString
int x = 23;
CString csNumber;
csNumber.format("%d", x);
This will do .....
Make urself comfortable with basic C++ before moving into MFC ....
int ,x,y; C++ Syntax (Toggle Plain Text)
strFreq.MakeUpper(); strHL.MakeUpper(); if(strFreq=="x" && strHL=="y")
Yesterday is a history, tomorrow is a mystery, today is a gift.
Behind every smile is a tear.
Visal .In
Behind every smile is a tear.
Visal .In
![]() |
Similar Threads
- Variable Problem (Visual Basic 4 / 5 / 6)
- Losing session variable problem...help! (ASP)
- Defining Variable problem (Visual Basic 4 / 5 / 6)
- Ie Variable Passing Problem**please Help** (Web Browsers)
- c++ compiling problem (C++)
Other Threads in the C++ Forum
- Previous Thread: Visual C++ 08 Express compiling issues...
- Next Thread: Need help - C++ program to determine area of triangle NOT using fstream
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates test text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






