Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Do you know a good textbook on C programming?

Link

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you need to initialize the values of i and j to something.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Are you combining client and server into just one program ? Or are they still two separate programs that are executed on the same machine ?

>>Also how do i set a static ip address in the code because the Winsock Server requires the user to type an ip address first, i would like to make it a default ip.

Just set the variable used for the manual entry to be "127.0.0.1", which is always the local machine.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Closed. This has gone on long enough.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

can you give the site cauz I have a assignment coming up and I dn't really wanna do it myself

Oh you poor poor lost soul -- Waaaaaaaaaaaaaaaaaaaaa :icon_cry:

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 39 is missing close parentheses -- ) Also you need to typecast total and sum to float to prevent loss of precision.

line 6: you are using uninitialized variables

Your program would run a bit better (faster and efficiently) if you used else if.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

hey how about my question?your post is not related to my thread?

You asked "what is a Trackback.". Well, I posted a link that answers your question. I'm not a mind reader, so if that wasn't really what you wanted then you will have to be much more specific.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First you have to allocate memory for ebase -- you are dereferencing an unallocated pointer. So the best you can do with that is ebase = *iter;

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what hardware are you referring to?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Oh I see that now. Move line 15 up to line 9 because lines 11 and 12 need that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That is a *nix file -- if you are compiling for MS-Windows of some other os then you can't use it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

just change lines 12 and 52 to use ifstream instead of istream. And since you did not code the using namespace std; you have to use std::ifstream ... to specify the std namespace.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

google for sort algorithms -- the code is all over the net. The easiest to code is the bubble sort.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Don't keep the numbers as a string, but as four integers. You could enter the values in the array in sorted order but that might be a bit more difficult. int numbers[4] = {0}; After they are entered then code a sort algorithm to sort them. Or you

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>and if not, repeat. Then display the list.
Displaying the list is not a requirement as the OP posted.

You could use an array, but its not necessary because there is no need to keep all the input values. Just sum them up as they are entered. You also need another counter to keep count of the number of entries the user entered. After all done, then just do the simple math.

This is really a very simple program that requires no (zero) advanced things such as <vector>, arrays or memory allocations. Don't make this more difficult than is needed.

VernonDozier commented: Good observation. +8
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I thought you said you know the basics. But apparently you don't.

int main()
{
   float mean = 0;
   float range = 0;
   float num = 0;
   float sum = 0;
   int NumberInputs = 0;
   // infinite loop
   for(;;)
   {


   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is something else wrong. Post complete code. If its pretty large then hit the Go Advanced button and mnake it an attachment.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Istream vs ifstream: one of them works and the other does not.

Yes -- but do you know which one is the correct one ? (Hint: check spelling and capatilization).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I am at a university.

Quit. Go to some other university because that one obviously will teach you nothing.

Do you know what the mean is and how to calculate it? How about the range? If not, then google for those terms.

And like I said before, take it one small step at a time. As someone once said "use the Divde And Conquor" method to solve the problem.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The problem isn't compiling the program, it is deploying the final executable on another computer. Most likely the problem is the other computer(s) need some of the dlls that are in the download link I provided.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>There is no textbook.
What the hell :-O Are you doing this in some sort of school ? or learning c++ all on your own? I assumed you were in school, but maybe I was wrong.


What part(s) of the assignment don't you know how to do. cin or cout , or something else

I'm sorry, but we can't give you a complete course in c++. If you are on your own then I'd strongly suggest you spend some $$$ and buy a good c++ book that will teach you.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

See the first three answers to your other thread here.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

"to prompt" just smply means use cout to display the message cout << "Enter something\n"; and to get input for a string. You need to STUDY YOUR TEXTBOOK for other variations of cin and cout.

std::string myname;
cout << "Enter your name\n";
getline(cin, myname);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>wellwell of cos i know what program am using
Apparently not because you originally posted this in the C board, not C#.

I know next to nothing about C# -- the link I posted was for C++ since this thread was in the C++ board (where I moved it from the C board).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is an example of how you could do that

int main()
{
char origstring[] = "Once upon a time there were three little pigs.";
char StringToReplace[] = "were three little pigs";
char ReplaceString[] = " was a big bad wolf.";

char* ptr = strstr(origstring, StringToReplace);
if( ptr != NULL)
{
    char tmp[255] = {0};
    *ptr = 0; // truncate
    ptr += strlen(StringToReplace) + 1; // advance to beyond the string
    strcpy(tmp,origstring);
    strcat(tmp,ReplaceString);
    strcat(tmp,ptr);
    std::cout << tmp << "\n";

}


}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Start here

#include <iostream>
using namespace std;

int main()
{
   // put your code here

}

Re-read my previous post #2 and code one sentence at a time. Code the line that displays the prompt. Get that to work and compile, then code another line that asks for user input.

Have you read your textbook and done the example programs at the end of each chapter? If not, then you should do that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

C# mumbles and babbles on C++ forum ;)...

This doesn't look like C# to me :-O

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

My price is set at $250.00

You work cheap :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

how about a managed tree view

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Structure doesn't have restricted acces
In c++ they do -- structures are nearly identical to c++ classes, except the default access type is public. TMK there are no other differences between a structure and a class.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>No. I definitely do not know how to do it
That's why you are in school -- to learn how :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

google for the exact error message. Often google comes up with the answer. I recall seeing something about that problem before, but you didn't post the exact error message so I can't help you.

BTW: The express edition doesn't do deployments -- you will have to do it manually or with some other tool such as InstallShield.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Anyone know how to accomplish this task on visual studio with C++?
Yes. Do you? Hint: start out the program very simply and prompt for input. When that is done put that in a loop. Compile and correct all errors again. After that, add code to implement the rest of the requirements.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

something like

if( num < 0 || num > 100)
{
    cout << <message to user>
    return 1;
}

But normally instead of just exiting the program it should loop back and prompt for input again.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

TMK Bush II is the ONLY president to actually start a war.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Because you declared the structure within the body of the class you have to use the class scop operator when referencing the structure. Its not necessary to use the struct keyword. Blah::Values *getValues();

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you have to pass fstream objects by reference

void initBoard(ifstream& board){
	string squares;
	getline (board, squares, '\n');
	
	cout << squares;}<------------ For testing purposes, will do other stuff l8r
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

if you are using gcc for *nix or ms-windows, then there is no way to do it because those operating systems will not allow it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>i don't know even how to start writing the code
Start here

#include <iostream>
using std::cout;
using std::cin;

int main()
{
    // put your code here

}

First, you need to declare the matrix. How many dimensions does it have (2, 3, 4, 5, ...) What dimensions does it have? What type (int, short, double, char*, or something else?)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If its a text file then you have no other choice but to rewrite the entire file. Open original file for read, open another temp file for write. In a loop read a line from input file and if its not the line you want to delete just rewrite it to the putput file. If it is the line you want to delete just ignore it and read the next line. Do that until end-of-file. Close both files. Delete the original file. Rename the temp file to the name of the original file.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There have been lots of threads here about how to clear the screen. Like this one

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The only legal way to get them is by spending your $$$ for the Pro edition. The standard edition might support them too, I don't know about that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>range 0000h to ffffh instead of [0,1)
0xffff is -1 not +1 in signed short integer, but unsigned short integer its a pretty huge number -- for exact value see your limits.h header file. With 16-bit compilers a short and an int may be the same size, but on 32-bit compilers they are probably different sizes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'm not supprised that produces a core dump. line 10 declared a pointer that points to nowhere -- there is no memory allocated to it. If x is supposed to be an array then use malloc() to allocate memory for the array x = malloc(10 * sizeof(int)); will allocate an array of 10 integers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Today I learned that I have diabetes in my right eye. I've had the disease for about 10 years, and this was the first time my eye doctor detected any signs of it in my eye. Guess its about time I stop eating all those pizzas, McDonalds hamburgers, DQ cones and other fast food junk -- I'm a real junky for that too :'(

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Look at MSDN and it will tell you what header file and library you need for that function. All you had to do was search google for that function and the link appeared as the very first link. Took me all of about 10 seconds to find it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The problem is line 9: remove the \ (line continuation character) at the end of the line.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

VC++ 2008 Express. But you should be able to compile that with g++ or any other modern compiler on either *nix or MS-Windows since the code I posted is just standard c++ code.