|
I'm not sure if this is on the right posting area, but ill ask anyway
I have been making a database program so that i can hold info and other junk that i need.
But when i make it ya know, it doesn't keep it when you close out, i was wondering if there is anyway i can save and load it? or even keep the info in there.
"An eye for an eye makes us all blind." - Gahndi
|
|
|
|
|
You need to give more information. What are you using to update a database? Please give an example of your problem code!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
sorry forgot, here ya go, im not updating, im creating
#include <iostream>
#include <string>
using namespace std;
struct person {
string firstName;
string lastName;
int age;
double height;
};
int menu(int &menuChoice);
void userInfo(person user[], int size, int const track);
void listUser(person user[], int size, int const track);
int main()
{
int menuChoice;
int static track = 0;
person user[50];
do {
menu(menuChoice);
switch(menuChoice) {
case 1:
userInfo(user, 50, track);
track++;
break;
case 2:
listUser(user, 50, track);
break;
}
} while(menuChoice != 3);
return 0;
}
int menu(int &menuChoice)
{
do {
cout << "- Menu -" << endl;
cout << "1 - Enter user and info" << endl;
cout << "2 - List all users and info" << endl;
cout << "3 - Quit" << endl;
cout << "nPlease enter your choice: ";
cin >> menuChoice;
if( menuChoice > 3 || menuChoice < 1) {
cout << "nPlease select an existing option!n" << endl;
}
} while(menuChoice > 3 || menuChoice < 1);
return menuChoice;
}
void userInfo(person user[], int size, int const track)
{
cout << "Enter your first name:";
cin >> user[track].firstName;
cout << "Enter your last name:";
cin >> user[track].lastName;
cout << "Enter your age:";
cin >> user[track].age;
cout << "Enter your height(cm, ex: 150):";
cin >> user[track].height;
return;
}
void listUser(person user[], int size, int const track)
{
int count;
cout << "nnUsers" << endl;
cout << "---------------" << endl;
for(count = 0; count < track; count++) {
cout << "First name: " << user[count].firstName << endl;
cout << "Last Name: " << user[count].lastName << endl;
cout << "Age: " << user[count].age << endl;
cout << "Height: " << user[count].height << "cm" << endl;
cout << "---------------nn" << endl;
}
return;
}
"An eye for an eye makes us all blind." - Gahndi
|
|
|
|
|
You need to write code to save your data to the hard drive or some other resource such as a database. However, there is no simple answer on how you should save your data from memory and recovering it from an resource. If you are just creating a personal database used only by you, you still have to consider what are your immediate and future requirements. You have a primitive interface to insert records and to sequentially list them. If that is all the functionality you need, then saving your records to a comma separated file may be all that you need. You can use the Standard Library's file streams to do this. To access the file streams, you need to have: #include <fstream>. You can google the web to find examples on how to use the file streams: http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=73&rl=1[^]
By the way, you are in the wrong forum. You should be in the Visual C++ forum.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
1) I need code written by some body else for string concatenation without using sting functions?
2)Taking the variables from string in alphabatic order.
For example:
we r entering a word called MARK.It has to print in alphabatic order ie: MARK as AKMR.
3)write a program for printing in between numbers (Ex: 3,4,9,7,10,14,54,8) print the numbers existing inbetween 3 and 8.
|
|
|
|
|
If you have written some code, please ask a specific question concerning that code. A sample of your coding problem is always helpful.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
i need one example program code.......
|
|
|
|
|
I am sorry. You won't get that kind of help here. A simple string in C++ is an array of characters terminated by a NULL character. You need to write your program to operate on that array probably using pointers. So, crack open a C++ primer and get to work.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I want string programs in c++ without using string functions
1)write a program for string concatenation without using string concatenation function.
2)Taking the variables from string in alphabatic order.
|
|
|
|
|
Are you required to use Managed C++ for this? If not, you should post your question on the
VisualC++/MFC[^] board.
Hamsika rani wrote: 1)write a program for string concatenation without using string concatenation function.
Have you written some code you need help with or do you need someone to write it for you?
Hamsika rani wrote: 2)Taking the variables from string in alphabatic order.
What is a variable in a string?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
1) I need code written by some body else for string concatenation without using sting functions?
2)Taking the variables from string in alphabatic order.
For example:
we r entering a word called MARK.It has to print in alphabatic order ie: MARK as AKMR.
3)write a program for printing in between numbers (Ex: 3,4,9,7,10,14,54,8) print the numbers existing inbetween 3 and 8.
|
|
|
|
|
We help programmers that have specific coding issues. We don't develop code or solve homework assignments. The code written by somebody else must be written by you. You learn by doing.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
i am trying to test a app. while _UNICODE defined. but when i define _UNICODE
in the app. it gives me following error.
Unicode_Test error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
i have included all necessary libraries. where i am going wrong?
Thanx in advance.
|
|
|
|
|
Sandeep,
This is wrong forum for this question. Ask it in VC++ forum ,instead.
Prasad
MS MVP - VC++
|
|
|
|
|
When performance is not an issue and when all that we want is just a snapshot of the desktop, we can consider the GDI option. This mechanism is based on the simple principle that the desktop is also a window - that is it has a window Handle (HWND) and a device context (DC). If we can get the device context of the desktop to be captured, we can just blit those contents to our application defined device context in the normal way. And getting the device context of the desktop is pretty straightforward if we know its window handle - which can be achieved through the function GetDesktopWindow(). Thus, the steps involved are:
Acquire the Desktop window handle using the function GetDesktopWindow();
Get the DC of the desktop window using the function GetDC();
Create a compatible DC for the Desktop DC and a compatible bitmap to select into that compatible DC. These can be done using CreateCompatibleDC() and CreateCompatibleBitmap(); selecting the bitmap into our DC can be done with SelectObject();
Whenever you are ready to capture the screen, just blit the contents of the Desktop DC into the created compatible DC - that's all - you are done. The compatible bitmap we created now contains the contents of the screen at the moment of the capture.
Do not forget to release the objects when you are done. Memory is precious (for the other applications).
Void CaptureScreen()
{
int nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
int nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
HWND hDesktopWnd = GetDesktopWindow();
HDC hDesktopDC = GetDC(hDesktopWnd);
HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);
HBITMAP hCaptureBitmap =CreateCompatibleBitmap(hDesktopDC,
nScreenWidth, nScreenHeight);
SelectObject(hCaptureDC,hCaptureBitmap);
BitBlt(hCaptureDC,0,0,nScreenWidth,nScreenHeight,
hDesktopDC,0,0,SRCCOPY|CAPTUREBLT);
SaveCapturedBitmap(hCaptureBitmap); //Place holder - Put your code
//here to save the captured image to disk
ReleaseDC(hDesktopWnd,hDesktopDC);
DeleteDC(hCaptureDC);
DeleteObject(hCaptureBitmap);
}
In the above code snippet, the function GetSystemMetrics() returns the screen width when used with SM_CXSCREEN, and returns the screen height when called with SM_CYSCREEN. Refer to the accompanying source code for details of how to save the captured bitmap to the disk and how to send it to the clipboard. Its pretty straightforward. The source code implements the above technique for capturing the screen contents at regular intervals, and creates a movie out of the captured image sequences.
In consideration to the above code please let me know how to capture the network PC`s desktop to my software..
I want to capture it continously i dont want to save it, i want it`s Rectangular Area in ma software...
Please let me know how to do this(of course sockets are used) or create a method for this...
|
|
|
|
|
HassanKU wrote: In the above code snippet,
In the above snippet there is no C++/CLI. You are in the wrong forum. Try the visual C++ forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Can someone help me with the link errors in this[^] project.
I was tryin to resolve this from last friday with no success. Would be gr8 if someone can compile this for me without errors. It gives me link errors whenever I use TIFFReadRGBAImage, but once I comment it out there are no errors. Any help...!!
-thanks.
Pavan
|
|
|
|
|
Obviously, you're not linking to the TIFF library properly. If you're using C++/CLI, you have built in tiff support. If you're not using .NET, you can still use GDI+, but you'd then be in the wrong forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi all,
will anybody plz tell me what is the meaning of the following error. it has troubled me a lot.
thanx in advance.
AuthXParser error LNK2019: unresolved external symbol "public: __thiscall TinyXPath::xpath_processor::xpath_processor(class TiXmlNode const *,unsigned short const *)" (??0xpath_processor@TinyXPath@@QAE@PBVTiXmlNode@@PBG@Z) referenced in function "public: class XMLNodeList __thiscall XMLNode::selectNodesW(unsigned short const *)" (?selectNodesW@XMLNode@@QAE?AVXMLNodeList@@PBG@Z)
|
|
|
|
|
It looks like you forgot to add the proper library in the linker command line.
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.
|
|
|
|
|
Hello everyone,
I'm want to build a Gpib drivers for an Agilent instruments.
Now...I want it to be a "class a-like" driver , for example if the user wants to set a center frequency of 100MHz in a spectrum driver it will look like this:
...
// defenition
Agilent_Spectrum spectrum;
// initialization
spectrum.init(9);
// send a frequncy
spectrum.frequncy.center.MHz=100;
...
The question is : can I do it without using classes ?
|
|
|
|
|
Using just plain C you can do whatever you want. It's enough to you, isn't it?
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.
|
|
|
|
|
The answer would be, if you're not using classes, you're probably not using C++/CLI, so you must be asking in the wrong forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
(I do work in c++, and I do know how to use classes...classes is the answer for my problem but it's a lot of work).
I didnt say that Im not using classes...I said I want to do it without using classes...meaning:
the question is "can I do it in a simple and more primitive way ?" maybe something like "namespace" or structures ?
|
|
|
|
|
Yes, I can see that you're working in C++, but, again, this is the C++/CLI forum, and you are not using C++/CLI as far as I can see.
Of course you can write anything you like without using classes, just like I can walk to the store instead of driving. You are not forced to use the tools that make yuor job easier.
Oh, and a struct IS a class, they are the same thing, the only difference is the default access modifier.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|