Ancient what is your msn let me send you what i done till now.
Sorry. I don't do private tutoring.
Ancient what is your msn let me send you what i done till now.
Sorry. I don't do private tutoring.
Do you have appropriate permissions from program authors to package all those programs into a single download, and in writing? If not then your web site may be violating copyright laws and you could get sued.
It's bad coding to do what openRecords() is doing. The ifstream object should be declared in main then passed by reference to OpenRecord()
int main ()
{
//Title
cout << " Employee sales records.\n" << endl;
//Get the file stream or quit if the records file is not found.
ifstream fileStream;
OpenRecords(fileStream);
}
void OpenRecords(ifstream& CheckFileStream)
{
// Make sure the records file exists before running the program
cout << "\n Welcome, performing record check..." << endl;
// Create a pointer to the filename
const char* FilePntr = "SalesRecords.txt";
// Attempt to open the file, if good return pointer of open file stream else report error and exit.
CheckFileStream.open(FilePntr);
if (!CheckFileStream.is_open()) // <<<<<<<<<
{
cout << "\n Record file found."<<endl;
}
else // Inform of file not found/or empty file and exit the program
{
cout << "\n RECORD FILE NOT FOUND!\nTHIS PROGRAM WILL NOW EXIT\n"<<endl;
system("PAUSE");
exit(1); // <<<<<<
}
}
I have found experimentation to be a good teacher. Create an empty win32 application project then read through this tutorial. That will give you some basic knowledge of what's all involved in coding a program using win32 api C-style functions (all win32 api functions are C, not of them are c++, although they can be called from c++ and other languages).
I think you will quickly realize windows forms is a lot easier to code.
There's nothing magic about what I posted. Just a simple loop that adds endl to the end of all but the last line. Instead of an loop of 10, and it a loop of 9. After the loop finishes the last line is saved without endl.
You are right. The number of bits in a byte is hardware dependent.
Oops. That was probably my fault for posting that bad code.
you could create an 18-byte character array, assuming 8 bits to the byte. Files do not contain bits -- they contain bytes, and the number of bits to the byte is operating system dependent. On MS-Windows and *nix there's 8 bit to the byte. So 128 bits would be 128/8 = 18 bytes.
Compare the code you posted with the code I posted. They are not the same.
Sure, why not?? There have been a lot of theories about where we came from. Mars is as good an explanation as any other because they are all nothing more than guesses. No physical proof exists anywhere in the universe about how life in Earth got started.
Even if they find DNA similarities between Earth and Mars it doesn't mean a damn thing because the same DNA similarities could exist between all planets everywhere in the universe. We don't know, and we probably will never know.
What do you need help with? We can't help you if you can't tell us.
If you can't use c++ objects then use FILE* and call fgets() in a loop until end-of-file is reached, counting the number of iterations of the loop. When done, you will have the number of lines in the file.
win32 project will require you to learn details of win32 api functions. That can be very time consuming with about a year's learning curve to learn it well. You can do useful things in a lot less time than that.
Windows Forms is grad-and-drop, but is C++/CLR, not c++. C++/CLR is a slightly different language, but not difficult to pick up if you already know c++. You will have to learn how to use Windows Forms and how to make the buttons and other objects you put on the form do things, such as writing event handlers for them.
Empty Project: not very useful unless you already have code and just need a project to put them in.
>>Ok, so time() function (argument being null) returns what?
It returns the number of seconds since 1970, as you previously posted. It doesn't matter whether the parameter is NULL or not, it will always return the same value.
Post what you tried because you must have made a mistake.
DLLs written in C++ can not be used by non-c++ languages unless you make the functions look like C functions by adding extern "C" to them, which prevents the compiler from mangling function names. In otherwords you will have to write C wrapper functions around the c++ code in the DLL.
What compiler are you using? I compiled with vc++ 2010 express on MS-Windows and did not get any linking errors.
Yes I know you wasn't referring to me. I'm not old.:) People's ability to do outdoor sports start to fail about age 30. Men are over the hill by that age, but women are just getting started.
That really has nothing to do with getting old. I know young people who are bed ridden due to failing health or illness.
IMHO the easiest way to count letter frequencies is to use an array of 255 elements -- which is large enough to count all possible characters. Then you can just use the letter itself as the index into the array.
Like this simple example: You would put this in a loop for each character
int counts[255] = {0};
counts['A']++;
char c = 'B';
counts[c]++;
Now to output all the counts
for(int i = 0; i < 255; i++)
{
if( counts[i] > 0)
cout << "Letter " << (char)i << " is " << counts[i] << '\n';
}
Here is a Microsoft article you will want to study. I'm not sure that C# can access DLLs written by non-.NET languages.
String::Split() apparently has performance issues
http://msdn.microsoft.com/en-us/library/b873y76a.aspx#
The Split methods allocate memory for the returned array object and a String object for each array element. If your application requires optimal performance or if managing memory allocation is critical in your application, consider using the IndexOf or IndexOfAny method, and optionally the Compare method, to locate a substring within a string.
When you remember first-run epesodes of The Lone Ranger tv shows.
Yes, you should do it yourself. Afterall, its your grades, not ours. I for one could care less whether you pass or fail that course.
There's a couple ways to avoid storing that extra '\n' at the end of the text file. One way is like this:
ofstream myfile("Stock.txt");
if (myfile.is_open())
{
for(int i=0; i <8; i++)
myfile << number[i] <<endl;
myfile << number[i];
}
line 17: p is an uninitialized iterator so the while statement fails. You might want to initiazlize it to p = NumList.begin() before line 17.
That won't fix the problem either. Another problem: what happens when the number of elements in NumList is less than the value of q? In the beginning there will be 4 elements in NumList. When line 23 erases one of the numbers then NumList will have only 3 elements, yet the value of q is incremented by 1. Eventually q will exceed the number of elements in the vector.
A third problem is that erase() will invalidate the value of iterator it in the for loop on line 21. When erase() is called the iterator it has to be re-initialized to NumList.begin() to start the for loop all over again.
Yup -- you are right, it does work with vc++ 2010.
http://msdn.microsoft.com/en-us/library/36k2cdd4(v=vs.71).aspx
Syntax Form Action
Quoted form This form instructs the preprocessor to look for include files in the same directory of the file that contains the #include statement, and then in the directories of any files that include (#include) that file. The preprocessor then searches along the path specified by the /I compiler option, then along paths specified by the INCLUDE environment variable.
Angle-bracket form This form instructs the preprocessor to search for include files first along the path specified by the /I compiler option, then, when compiling from the command line, along the path specified by the INCLUDE environment variable.
Yes, but be careful not to overflow the integers. check limits.h to see the maximum value that can be stored in an integer with your compiler.
You need to check the laws of the country in which you are located. Probably ask a lawyer or solicitor.
I already mentioned one solution. using doubles just introduces inprecision. Maybe something like this:
// this might work if all you are interested in is one decimal place.
int start;
int stop = (int)(ust*10.0);
for(start = (int)(alt*10.0); start <= stop; start++)
{
}
What you are asking is how to reformat a simple text file -- csv files are just text files. Read the file one line at a time, make apprporpate changes then write the new line back out to a different file. If the file is small enough you could read the whole file into a vector or array of strings, make changes to them, then re-write the file with the new data. Thes are all standard file i/o functions and if you know how to read and write text files then you can easily read/write that csv file.
doubles can not be represented exactly in memory. The value of 0.1 may or may not be represented in memory as 0.100001 or something like that, and that's why incrementing 3.9 by 0.1 may cause the number to be greater than 4.0. There is little, if anything, you can do about it except convert the doubles to integers and use the integers in the loop.
try
#include "windows.h"
Depends on the compiler. That won't work with vc++ 2010 (or any earlier version of Microsoft compilers). On some other compilers it doesn't matter whether you use quotes or angle brackets.
Check your computer to see if it already contains windows.h and associated headers/libraries. If it does, then all you have to do is tell your compiler where they are located. If not, then you need to download the Windows Platform SDK, free from Microsoft web site.
>>PLEASE DO NOT GIVE ME AN UPDATE LINK
Ok, so I won't tell you where you can get it.
ReadToEnd() will not read into that String^ vector. It requires a buffer of contiguous memory. If you want to read that file line-by-line then use the example in the link below.
>>When you retired, you could do whatever thing you want
Yea -- right. And if you believe that I have some shares in the Golden Gate Bridge that I'll gladly sell you.
>>but I think every one should be free to do whatever, he or she wants
Right -- I should have the right to go into a school and shoot everyone. I should have the right to steal eveything I want from a grocery store. I should have the right to have sex with anyone I want whether they want to or not. I should have the right to cheat on school exams.
There are lots of things in this world that restrict our behavior. As someone once said, your rights stop at my nose.
Vernon was still correct -- there is no wait() in time.h.
No you haven't. Windows uses Sleep() not sleep() (capital S). Also, *nix sleep() parameter is in seconds -- MS-Windows Sleep() parameter is milliseconds.
Standards use the sleep(seconds) function, not wait.
there are no standards for waiting. *nix, MS-Windows and MS-DOS all use something else. The c++ standards say nothing at all about the topic.
I think wait() is an old Turbo C function.
Your formatting leaves a lot to be desired. It's a lot easier to read and debug if you only put one statement on a line instead of trying to put several on the same line. Most debuggers can't work with that formatting style. Once you learn how to format your code better it will be a lot easier to find mistakesw.
Here is an example of what I am talking about
int insertNode(NODE **head,int i)
{
NODE *newNode;
newNode = (NODE *)malloc ( sizeof (NODE));
newNode->content = i;
NODE *temporary= *head;
newNode->nextLink=NULL;
if ( (*head == NULL) || ((*head) -> content) < i)
{
*head = newNode ;
(*head)-> nextLink = temporary ;
}
else
{
do
{
if ( ((temporary-> content) > i ) && ((temporary-> nextLink ->content) < i))
{
newNode -> nextLink = temporary -> nextLink;
temporary -> nextLink = newNode;
return ;
}
else if(temporary->content==i)
{
printf("To be inserted value is already in the list\n");
return ;
}
temporary=temporary->nextLink;
}while ( temporary->nextLink != NULL );
if(temporary->content==i)
{
printf("To be inserted value is already in the list\n");
return;
}
temporary->nextLink=newNode;
}
return 0;
}
What compiler are you using? I just successfully compiled/linked using vc++ 2010 Express. First created an empty win32 project, added a *.cpp file and copied your code into it. Compiler and linked without any warnings or errors.
Maybe you created a standard console project instead of a win32 project?
Consider the source. Your comment was completely on the mark and justified and you got down-voted precisely BECAUSE it was completely on the mark and justified. Upvoted from me as a counterbalance.
Ditto
No one here will do your homework for you unless you want to pay some very big $$$.
From your profile ancient dragon, it seems that you have a pet dog. Can tell me more about your dog. I am interested in pets. When you start to work, you have to buy a house, get a wife. Everything requires money, in school everything requires good grades
I won't hijack this thread by talking about my dog (and cat too).
std::string.find() does not return an integer -- it returns an unsigned integer. So checking for -1 will not work. It should be checked against std::string::npos.
if( s.find(t1) != string::npos)
{
}
Works for me :) Thanks.
Since updateDifference() is a void function you can't set a variable = to it. The function is going to change the value of totalOfDifferences because it's passes by reference. Example below.
updateDifference(cashPrice, creditPrice, totalOfDifferences);
cout << " prices is now R " << totalOfDifferences << endl;
The way to solve it is not to put that function call on the same line as the cout statement. Put that function call statement on its own line before that cout line so that the cout and display the new values of those variables.