<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Need help with this h/w assignment....plz' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Need help with this h/w assignment....plz' posted on the 'Beginner C/C++' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 25 May 2013 18:04:54 -0700</pubDate>
    <lastBuildDate>Sat, 25 May 2013 18:04:54 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Need help with this h/w assignment....plz</title>
      <link>http://www.programmersheaven.com/mb/beginnercpp/381157/381157/need-help-with-this-hw-assignmentplz/</link>
      <description>Write a complete C++ program to:&lt;br /&gt;
&lt;br /&gt;
In the main body of the program declare three integer variables X, Y, Z.&lt;br /&gt;
&lt;br /&gt;
Prompt the user for any three integer values for the three variables.&lt;br /&gt;
&lt;br /&gt;
Call a function named Largest and pass the three integer variables.&lt;br /&gt;
&lt;br /&gt;
Create the function named Largest that will receive the three integer variables. The function must determine the largest value of the three integer variables and return the largest value through the function name so the largest value can be printed in the main body of your program.&lt;br /&gt;
&lt;br /&gt;
So far I have...&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;math.h&amp;gt;&lt;br /&gt;
#include &amp;lt;iomanip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int x,y,z;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char*argv[])&lt;br /&gt;
{&lt;br /&gt;
    cout &amp;lt;&amp;lt; "Please enter in integer for x:";&lt;br /&gt;
    cin &amp;gt;&amp;gt; x;&lt;br /&gt;
    cout &amp;lt;&amp;lt; "Please enter in integer for y:";&lt;br /&gt;
    cin &amp;gt;&amp;gt; y;&lt;br /&gt;
    cout &amp;lt;&amp;lt; "Please enter in interger for z:";&lt;br /&gt;
    cin &amp;gt;&amp;gt; z;&lt;br /&gt;
    &lt;br /&gt;
    system("PAUSE");&lt;br /&gt;
    return EXIT_SUCCESS;&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
Can someone please tell me how to call a function... or better yet fill out the code and explain to me what they did.</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/beginnercpp/381157/381157/need-help-with-this-hw-assignmentplz/</guid>
      <pubDate>Mon, 13 Oct 2008 19:03:30 -0700</pubDate>
      <category>Beginner C/C++</category>
    </item>
    <item>
      <title>Re: Need help with this h/w assignment....plz</title>
      <link>http://www.programmersheaven.com/mb/beginnercpp/381157/381164/re-need-help-with-this-hw-assignmentplz/#381164</link>
      <description>: Write a complete C++ program to:&lt;br /&gt;
: &lt;br /&gt;
: In the main body of the program declare three integer variables X, &lt;br /&gt;
: Y, Z.&lt;br /&gt;
: &lt;br /&gt;
: Prompt the user for any three integer values for the three variables.&lt;br /&gt;
: &lt;br /&gt;
: Call a function named Largest and pass the three integer variables.&lt;br /&gt;
: &lt;br /&gt;
: Create the function named Largest that will receive the three &lt;br /&gt;
: integer variables. The function must determine the largest value of &lt;br /&gt;
: the three integer variables and return the largest value through the &lt;br /&gt;
: function name so the largest value can be printed in the main body &lt;br /&gt;
: of your program.&lt;br /&gt;
: &lt;br /&gt;
: So far I have...&lt;br /&gt;
: &lt;br /&gt;
&lt;pre class="sourcecode"&gt;
: #include &amp;lt;cstdlib&amp;gt;
: #include &amp;lt;iostream&amp;gt;
: #include &amp;lt;math.h&amp;gt;
: #include &amp;lt;iomanip&amp;gt;
: 
: &lt;span style="color: Red;"&gt;int x,y,z;&lt;/span&gt;
: 
: int main(int argc, char*argv[])
: {
      &lt;span style="color: Blue;"&gt;int x,y,z;&lt;/span&gt;
:     cout &amp;lt;&amp;lt; "Please enter in integer for x:";
:     cin &amp;gt;&amp;gt; x;
:     cout &amp;lt;&amp;lt; "Please enter in integer for y:";
:     cin &amp;gt;&amp;gt; y;
:     cout &amp;lt;&amp;lt; "Please enter in interger for z:";
:     cin &amp;gt;&amp;gt; z;
:     
:     system("PAUSE");
:     return EXIT_SUCCESS;
: } 
: &lt;/pre&gt;&lt;br /&gt;
: Can someone please tell me how to call a function... or better yet &lt;br /&gt;
: fill out the code and explain to me what they did.&lt;br /&gt;
&lt;br /&gt;
You're well under way. Just one minor remark: x,y and z are local variables and should be declared inside the main function. I have made this change for you in colors above.&lt;br /&gt;
I think you can figure out the actual code for the function yourself. So, I'll just show you how to declare and call your function.&lt;br /&gt;
Basically, your function declaration looks like this:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
int Largest(int value1, int value2, int value3)
{
&lt;span style="color: Green;"&gt;  //TODO: Return largest value&lt;/span&gt;
}
&lt;/pre&gt;&lt;br /&gt;
The TODO you have to code yourself.&lt;br /&gt;
&lt;br /&gt;
There's one more thing though: you'll want to 'prototype' your function. This sounds like a very complicated thing, but it just means that you tell your compiler what the function is going to look like (what its name is and what parameters it takes), before the actual function body (the code I posted above).&lt;br /&gt;
&lt;br /&gt;
Prototyping is basically copy &amp;amp; pasting the first part of the function declaration to roughly the beginning of the file.&lt;br /&gt;
So, the overall layout of your code will look like:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
#include &amp;lt;cstdlib&amp;gt;
#include &amp;lt;iostream&amp;gt;
#include &amp;lt;math.h&amp;gt;
#include &amp;lt;iomanip&amp;gt;

&lt;span style="color: Green;"&gt;//To use cin and cout without having to prepend the
// std:: namespace specifier to them, you should add the following&lt;/span&gt;
using std::cout;
using std::cin;
--or--
using namespace std;

&lt;span style="color: Green;"&gt;//Note the ; at the end, and the absence of the function body { }&lt;/span&gt;
int Largest(int value1, int value2, int value3);

int main(int argc, char* argv[])
{
  ...
}

int Largest(int value1, int value2, int value3)
{
&lt;span style="color: Green;"&gt;  //TODO: Return largest value&lt;/span&gt;
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Good luck and if you have further questions don't hesitate to ask.&lt;br /&gt;
Best Regards,&lt;br /&gt;
Richard&lt;br /&gt;
&lt;br /&gt;
The way I see it... Well, it's all pretty blurry</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/beginnercpp/381157/381164/re-need-help-with-this-hw-assignmentplz/#381164</guid>
      <pubDate>Mon, 13 Oct 2008 20:45:22 -0700</pubDate>
      <category>Beginner C/C++</category>
    </item>
  </channel>
</rss>