|
tanchinchee wrote: 1. Tan Chin Chee AD051810
This will be a problem to handle: you have three words (they are separated by a white space) for the name...
Maybe what you could use to encode your data is xml, so your file will look like this:
<list>
<student Name="Tan Chin Chee" Id="AD051810">
<AttendingClass Name="Dynamics">
<AttendingClass Name="Thermo">
</student>
...
</list>
This will make things much more easier and you will be able to add things quite easily (like schedules for the classes or other information about your student). But of course, this will require to understand a little bit how xml works (but for these kind of things it is really really easy).
If you choose to use xml, you can find here[^] a nice xml parser.
|
|
|
|
|
Another thing. I have been trying to use the following source code to compare the input name from the user to the name store in the database but fail. Can i know what is the problem?
#include <iostream>
#include <fstream>
#include <cstring>
void main()
{
char n1[20],n2[20];
cin>>n1;
ifstream infile("C:\\test.txt");
infile>>n2;
while(n1!=n2)
{
infile>>n2;
if(strcmp(n1,n2))
cout<<"False";
else
cout<<"True";
}
}
Well, it turns out to be an infinite loop. Why is that? And how do i change it?
|
|
|
|
|
tanchinchee wrote: Well, it turns out to be an infinite loop.
Yes, that's normal. Simply because of that:
while(n1!=n2)
What you are comparing there is two pointers (you don't compare the contents of the string but the pointers). These pointers will always point to a different address, even if the two contents are the same.
You need to compare the strings, not the addresses:
while(strcmp(n1,n2))
But as you are already doing that inside the loop, it would be better to rewrite the loop in such way:
while(strcmp(n1,n2))<br />
{<br />
cout << "false";<br />
infile>>n2;<br />
}<br />
cout << "true";
In fact, you will only print true when the two strings are the same so when you exit the loop.
By the way, when you post code, use the pre or code tags (just above the emoticons).
|
|
|
|
|
why no one is answering for the threads posted. since last week i am not getting a good response. pls help me i am need guidance for tree control. i am new to this.
-- modified at 1:51 Monday 2nd April, 2007
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
|
Thanks Mr.Sky . i need some advice on creating an application that looks'n feel like windows explorer:
-one CTreeCtrl in left side of the dialog
-if we select one item in the tree it have to list the contents of a folder
-Data displayed in CTreeCtrl are files and directories
pls help me i need it now
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Hope I understood your question
I think it will be easy for you I wrote like your question for show images (in the continue with you you need to a CListCtrl)your answer is exist on the codeproject but on the different articles(See Folder/File section and CTreeCtrl section);)
|
|
|
|
|
yes but till now noone gave me the idea to create the window. i dont want the code to written by someone. i just need the guidance
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
You can see these articles for help
|
|
|
|
|
|
You can find these articles on the Folder/File section and CTreeCtrl section
|
|
|
|
|
deeps_cute wrote: -one CTreeCtrl in left side of the dialog
-if we select one item in the tree it have to list the contents of a folder
my general idea would be look at CTreeCtrl Class and CFindFile class
|
|
|
|
|
Probably because you don't seem to be putting in any effort yourself - you seem to want someone here to write your program for you.
In one of your earlier posts someone pointed you to the TreeControl section of codeproject. A quick check shows
PathPicker[^]
that seems to have all the functionality you need for the tree control. There may be other ways to start - it's your program after all.
If you tried to get PathPicker going with an associated listbox that you fill with the contents of the directory you choose, and when you have specifc problems come back and ask, I'm sure you will get an answer.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Dear all.
Now I doing a project with MFC, so I would like ask you how to call child frame with any location (x, y) in the Main frame. Notice that when I called the child frame No.1, it locates at the left corner of Main frame and when I continue to call the child frame No.2, it appears at the same location of child frame No.2. Thank in advance all.
|
|
|
|
|
What about SetWindowPos ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
First the child frame will be locate at pixel 0x0 and then call the seconde chid frame at position 320x0. I'm just strt with VC++ so please show me more detail thank very much all
|
|
|
|
|
Something like this?
CRect WindowRect;
pChildFrameWnd1->GetWindowRect(&WindowRect);
pChildFrameWnd1->MoveWindow(0, 0, WindowRect.Width(), WindowRect.Height());
pChildFrameWnd2->GetWindowRect(&WindowRect);
pChildFrameWnd2->MoveWindow(320, 0, WindowRect.Width(), WindowRect.Height());
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
I've looked at all the tutorials for using tcp and sockets with C++. But all of them either give me code errors or linker errors when I try to compile and test the example programs. Does anyone know of a tutorial that works?
oh yea I'm using Visual C++ 2005 express edition.
|
|
|
|
|
|
I've installed the platform sdk. and the linker errors are about something called symbols
|
|
|
|
|
Show the actual error messages and the code that's causing them.
|
|
|
|
|
Can u list the compile error or linking errors. So as to let u know the exact cause. Till then happy coding...
Get the facts or facts will get you and when you get them, get them right or they will get you wrong.
Happy Coding
|
|
|
|
|
Also if the tutorials are MFC then they won't work with VS2005 Express.
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
I am doing a project with VC++ 6.0. I want a bitmap picture can move. What I must do? Help me!!
My Email:quocviet_dhspkt@yahoo.com
Thank you very much!
Love You Much!
|
|
|
|
|
You only need to re-draw this picture at appropriate position. For example, now it's at (10, 10, 20, 20), if you want to move to (100, 100, 110, 110) you will must draw this picture at new position
My English is not good, so you mayn't understand what I said.
|
|
|
|