NathanOliver 429 Veteran Poster Featured Poster

What no one helped you the first time so you are trying again? It's been 5 days and all you have come up with is "give me the code".

NathanOliver 429 Veteran Poster Featured Poster

Yes Java is multi-platform but that can misleading as well. Different java runtimes can produce different behavior. If you use something from a newer version of Java it might not work on some machines running an older runtime. I ran into this in my Java class.

jwenting commented: wrong -3
NathanOliver 429 Veteran Poster Featured Poster

You start with a = 3. So line 2 will print a which is 3 then a gets incremented to 4. then it prints the space. Then a gets incremented to 5 then a which is 5 gets printed agian.

This has to do with how the post and pre increment operators work. a++ means give me a then add 1 to it. ++a means add 1 to a then give me what a now holds.

NathanOliver 429 Veteran Poster Featured Poster

Okay. What do you have so far? Do you know how to use for loops? Do you know how to use a char vareiable?

NathanOliver 429 Veteran Poster Featured Poster

functions return a reference so that there is less overhead in the function return. whatever value you store the return into will hold that value and it doesn't matter that the variable that was returned goes out of scope.

// non reference return
int foo()
{
       int a = 20;
       return a;
}
// reference return
int & foo()
{
       int a = 20;
       return a;
}

as you can see there is no difference between the code except how the return value is returned. it will still get assigned to the variable you have receiving the return.

NathanOliver 429 Veteran Poster Featured Poster

there is a function in the <string> header file called _stricmp that will convert all the characters to there lowercase. the function is defined as

int _stricmp( const char *string1, const char *string2 );

this function will return 0 if the strings are equal. less than 0 and greater than zero returns mean they do not match. to use this i would write

#include <string>
#include <iostream>

using namespace std;

int main()
{
string string1 = "abcd";
string string2 = "ABCD";
int equal;
equal = _stricmp(string1.c_str(), string2.c_str());
// using the c_str function here to pass the char array to the
 //function because it does not take in a string but a char
if (equal == 0)
cout << "the strings are equal"
else
cout << "the strings are not equal"
return 0;
}

hope this helps you out

Dave Sinkula commented: Bad advice in a number of ways. -4
NathanOliver 429 Veteran Poster Featured Poster

please open your textbook or your help file and look at the types of operators are in c/c++ before you start typing in symbols. % is not percent in c/c++ it is an operator dealing with integer division.

WaltP commented: Please read Ancient dragon's post, 3 HOURS before you. -3