49,761 Topics
| |
how would I go about making a variable in a class, that could be read directly but not written as such? Like, [icode]if(class1.variable==true){ }[/icode] is allowed but [icode]class1.variable = true;[/icode] is not... however I don't want a [icode]const[/icode], I want it to be able to be set from within the … | |
[CODE]TCHAR exepath[MAX_PATH]; GetModuleFileName(0, exepath, MAX_PATH); HKEY hKey; LONG lnRes = RegOpenKeyEx( HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", 0,KEY_WRITE, &hKey ); if( ERROR_SUCCESS == lnRes ) { lnRes = RegSetValueEx(hKey, "YourProgramsName", 0, REG_SZ, exepath, strlen(exepath)); }[/CODE] To add as a HKLM (For all users) startup item instead of HKCU (Current User), change HKEY_CURRENT_USER to HKEY_LOCAL_MACHINE. … | |
Hi, all i have the assignment about program which reads in integers from cin until the user enters a non-integer (a character or EOF), then print out the average. Its pretty simple assignment but i am kind of new. So the following is my code and seems like have some … | |
For some reason my if statement in both my [I]unionFunction[/I] and [I]intersectFunction[/I] is setting the array equal to 1 rather then comparing it. I've tried to figure out whats wrong but nothing seems wrong to me. I appreciate any help. Here is my program so far: [code] #include "stdafx.h" #include … | |
Hey guys, I'm going to be starting a research project pertaining to [URL="http://www.jauswg.org/index.shtml"]JAUS[/URL]. Basically, this is a standardized protocol to be used in autonomous robotics... someone will essentially connect to a robots IP and be able to transmit various commands over 802.11. I not exactly sure where to start, so … | |
[CODE]/* sscanf example */ #include <stdio.h> #include <iostream> using namespace std; int main () { float f; int i; char * the_string = "foo -3.6 fum dum 17"; int r = sscanf(the_string, "foo %f fum dum %d", &f, &i); cout << f << " " << i << " " … | |
Hello everyone. I am using ACE and I'm using the following method: ACE_OS::read(char* buffer, int nbbytes, int perms); I was informed that Windows is reading data from disk sectors and it puts the contents of the read sectors into the cache (who is in memory). I don't want that behavior … | |
Hello, I've got the following code: [code] wxString path = filepath; wxString newpath = filepath; fstream f(path.Append("/tests/tests.bin"), ios::in | ios::binary); fstream fnew(newpath.Append("/tests/temp.bin"), ios::out | ios::binary); Test* transferTest = new Test(); int thisSize = sizeof(Test); bool success = false; bool toBeDeleted = false; int testNo = 1; if (f) { f.seekg(0, … | |
When I executed the following code the output appears to be very strange to me. Can any one explain this unexpected result to me. The code: [code] #include <iostream> using namespace std; class Y { private: int x; public: Y() { x = 7; } int getX() { return x; … | |
Error : warning: cannot pass objects of non-POD type `struct std::basic_string<char, std::char_traits<char>, std::allocator<char> >' through `...'; [Code] int main() { ListeString Parts; ListeString::iterator iter; Parts.push_back("One"); Parts.push_back("Two"); Parts.push_back("Three"); iter = (*mtcParts)->begin(); while ( iter1 != (*mtcParts)->end()) { printf("%s\n",*iter1); iter1++; } getchar(); return 0; } [/code] By using cout, i am able … | |
hi I want to write some text on windows wallpaper. does anybody know how to do that. (on wallpaper ,but under window frames.). (dynamic text: like time. so please do not suggest to write it with paint. :) ) | |
Hello, I am having some trouble reading data from a .txt file. I know that the file contains strings separated by white space. The problem is, I don't know how many strings there are, so I would like to go through the file one string at a time, and then … | |
When a pointer is deleted, is the memory it is pointing to only returned to the heap or is it also nulled too? Thx | |
These are my three files. The header file.... [CODE] #ifndef MONTH_H #define MONTH_H #include <string> #include <iostream> using namespace std; class Month; ostream &operator<<(ostream &, const Month &); istream &operator>>(istream &, Month &); class Month { private: string month; int monthNumber; public: Month(); Month(string); Month(string, int); void setName(string); void setMonthNumber(int); … | |
Hi there, I am trying to write a C++ app using Dev-C++ 4.9.9.2. The app is supposed to read in a txt file and then use templates to read in the files and swap data that gets populated in a ptr array. The errors are: [Linker error] undefined reference to … | |
Hi. I am making a program, and I have a main section and a class that the main section tefers to in a .h file. The Ifstream part wont work, and i dont know why. Please help. MAIN: [CODE] #include <iostream> #include <cstdio> #include <cstdlib> #include <string> #include <fstream> using … | |
Can any one help or give some good advice on where I need to go from a point in my code. I am building an asterisks tree and I managed to get that part done, but there are three thing I need to input to complete the assignment. 1. And … | |
I'm having trouble getting my sprite to go from the right side of my screen to the left and then swap images so it appears to be walking back to the right side and then repeat that process. Ive manage to only get the cats to walk to either direction … | |
I'm writing a class planner with a structured array declared in the header [code=c++] #include <string> using std::string; struct Classes { string ClassName; string ClassNumber; string DaysMet; int StartTime; int EndTime; string Teacher; int Students; }; [/code] this is the print function of the program [code=c++] int Print() { system("cls"); … | |
hi, Here is my code on the three sorts. I've place in the counter called icompare&imove for insertion sort; bcompare&bmove for bubble sort and scomare and smove for selection sort. I've also used time_t as a timer to calculate the time it takes to sort the three. can someone please … | |
What I would like to do is write an application that a user can interact with through IE for submitting mathematical notations. What is the best method of doing this ? Will a plugin work or maybe a browser add-on or an active x control ? I am not familiar … | |
In my MFC c++ app, when I try to include afxwin.h into my project, it gives me these errors. Whats the problem with it? Did I misunderstand something? I'm using vc++ 2005 express if it makes a difference. [TEX]1>C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc/afx.h(250) : warning C4793: … | |
how would you seperate a character in a string. For example : string ="2x^2+8" how would i seperate the string into '2' 'x' '^' '2' '8'. so I could find its derivative. | |
PROBLEM : A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. I came up with a solution for the above problem. I … | |
I've searched all over the place and I cannot seem to find a well working, reliable solution to this that is not platform specific. Here is what I have: Main menu of a class (while loop with 0 as exit). User selects choices. Choice calls class function to carry out … | |
Hello all. Im back with another question : / You see.. At my house. We connect to our home network, in order to do so i must put in a HUGE Wep Password and bla bla bla. It takes for ever. And whenever lets say i get a new computer … | |
Hi, I have been working on a simple command line program that will simply store my data in the code variable then submit that data to another program. Although I have the thory right, I don't understand why the middle double quote ( " ) seems to escape the quotes … | |
Say I have a class (say number) and declare a private variable (say int num) and have a public member function(say int getnum() ) that retrieves the private variable. When I in the main() without initializing the private variable int num (of course after declaring the class variable say test) … | |
Using a long double, it seems to cut out a decimal when it increases another digit. The first scan won't work properly, as it only shows 3 decimals, but should have 4, which doesn't concern me, but i'd like it to always have three. Price: 5.99 Scanned Price (Over and … | |
hello.. thx in advance just want to ask something.. is there any portable functions that is equivalent to system("cls")? a function that clears the screen? since system() is not portable.. thx... |
The End.