Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Decryption help!!!

encryption

  • Please log in to reply
21 replies to this topic

#13 maria536

maria536

    CC Newcomer

  • Just Joined
  • PipPip
  • 21 posts

Posted 10 November 2011 - 10:21 AM

I'm not actually sure how to or what to put to change this to make it work! Sorry, I am still a beginner and I've been kinda workin on this for a week, I thought I had it but it's still not really working.
  • 0

#14 AKMafia001

AKMafia001

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 118 posts

Posted 10 November 2011 - 10:34 AM

Hey I guess you didn't read my post. I answered long ago.:P It's on the previous page (first page) of this thread.
  • 0
I think i'm able to write a code for printing "Hello, World!". Proud of that!

#15 maria536

maria536

    CC Newcomer

  • Just Joined
  • PipPip
  • 21 posts

Posted 10 November 2011 - 10:44 AM

I saw that, not sure what you mean!!!:D

---------- Post added at 10:44 AM ---------- Previous post was at 10:43 AM ----------

:DWhy is this so confusing to me, I just don't get it:w00t:!!!!!
  • 0

#16 AKMafia001

AKMafia001

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 118 posts

Posted 10 November 2011 - 10:59 AM

Probably you don't understand what programming is! You have to study a good book about programming.
  • 0
I think i'm able to write a code for printing "Hello, World!". Proud of that!

#17 maria536

maria536

    CC Newcomer

  • Just Joined
  • PipPip
  • 21 posts

Posted 10 November 2011 - 11:42 AM

Your probably right, but I'm trying!
  • 0

#18 AKMafia001

AKMafia001

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 118 posts

Posted 10 November 2011 - 11:57 AM

well! Don't climb directly -- start from the begining and solve beginner's problems. Learn and apply what you have learned and if you get any problem -- ask it. Surely you will get a help.
  • 0
I think i'm able to write a code for printing "Hello, World!". Proud of that!

#19 maria536

maria536

    CC Newcomer

  • Just Joined
  • PipPip
  • 21 posts

Posted 10 November 2011 - 12:04 PM

//define decryptLetterFunction
void decryptLetter (int)
{

}

I have been asking for help, but I am still not sure what I am doing wrong. The code is still not working.
  • 0

#20 AKMafia001

AKMafia001

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 118 posts

Posted 10 November 2011 - 12:35 PM

I told u early that the way you commented that this is prototype and that one is definition is wrong... Both are definitions in your case.

// function prototype
void decryptLetter(int);

While
//funtion defintion
void decryptLetter(int nVar)
{
//some code for the task

}

Now review your code and as i said in your case both are definitions and you have overloaded it for int... Probably you will get it this time.
  • 0
I think i'm able to write a code for printing "Hello, World!". Proud of that!

#21 fread

fread

    Programming God

  • Senior Member
  • PipPipPipPipPipPip
  • 897 posts
  • Location:Trinidad and Tobago
  • Learning:C, Java, C++, C#, PHP, Python, PL/SQL

Posted 10 November 2011 - 02:11 PM

The prototype is like the for-runner for the definition of the function. It defines exactly what arguments the funtion will take and what it will return. C++ has a feature called method overloading(well at least that is what i know it to be in java). What that means is if you prototype a function they way you are doing and then write the definition that is not in strict adherence with the prototype and use the same function name then you are in essence defining a new function. In your case you prototype takes one argument, a char, and you definition takes one argument, an int. As pointed out before those two functions/methods are not the same, that is overloading. AKMafia001 has the idea in the above post.
  • 0

#22 AKMafia001

AKMafia001

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 118 posts

Posted 11 November 2011 - 05:33 AM

Well! To make it vivid -- I'm gonna mess with your confusion...

Function Prototype: Function prototype is used to tell the compiler that the program will (may) use a function with such return type and with the same signature.
Return Type: It is the type of value which the function will return from it's body (scope) to the location from which it was called. The value is retured from the body of the function using the keyword return.

Signature: The function signature contains the remaings of the prototype other than the return type. Like, function name and it's parameters.

Example:
returnType   FunctionName(Parameter(s));

void decryptLetter(int);

Return Type   ->   void
Signature       ->   decryptLetter(int);  // This function has 1 parameter

Note: It is not necessary that the function for which the prototype is written must be defined. It is possible that the function prototype exist and would have no definition. In old C it was necessary to declare the function through it's prototype and define it latter. But now the declaration is not necessary we can define our function before main() without declaring it through function prototype.

--------------------------------------------------------------------------------------

Function Definition: Function Definition is the occurrence of the function prototype or it can be directly without it. In function definition -- it is directed to what it should do. The actual purpose and the task which the function will perform is specified in the definition. If the function is declared then it should have the same return type and the signature as of the declaration. In the body of the function definition -- the code is placed which is supposed to be executed by the function.

Example:
returnType   FunctionName(Parameter(s))      // same as it's declaration. No semicolon (;) in definition.
{

   // code
   // return, if the function return type is !void.
}

void decryptLetter(int nVar)
{
    int decLet = nVar + 32;    // your code and algorithm of decryption.

}

Function Overloading: When the same function is needed for some other task or it is supposed to accept and operate the values of other types then it may not be possible with the same code of the function. The types might differ or the code might have different operations. In this case we overload ( define it again ) the function for our needs.

Example:
int sum(int a, int b)   // for type int.
{
    return a+b;
}

If some float values are to be added?
Overload it.

float sum(float a, float b)  // for type float.
{
    return a+b;
}

Both can have different code in their bodies. The function name is same but have different type of parameters. The parameters can be of different number also.

Did I have exceeded!
Well! I stop it.

Hope it helps!
  • 0
I think i'm able to write a code for printing "Hello, World!". Proud of that!





Also tagged with one or more of these keywords: encryption

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download