LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-03-2010, 02:27 AM   #16
pr_deltoid
Member
 
Registered: Jun 2010
Distribution: Fedora
Posts: 289

Rep: Reputation: 41

I would ignore everyone's corrections to the code you posted, if you just copied it from the book. If you're just starting to learn and you're reading a good book, just learn from the book and afterwards worry about changing things. Don't start changing things instantly while you're just learning, it will just cause you to branch your thoughts off in twenty directions at once instead of just paying close attention to the book and learning from it.
But make sure that "end" is "endl" and prefixed with std::
as was suggested.

EDIT:
Also, I'm sure that as the book progresses it will clean things up a little more, it's just starting off that way.

Last edited by pr_deltoid; 09-03-2010 at 02:29 AM.
 
Old 09-03-2010, 06:53 AM   #17
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by jmc1987 View Post
Quote:
#include <iostream>
You should post code inside CODE tags, not inside QUOTE tags.
 
Old 09-03-2010, 10:05 PM   #18
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 56
Quote:
Originally Posted by johnsfine View Post
You should post code inside CODE tags, not inside QUOTE tags.
Agreed. If you put code inside QUOTE tags, quoting the post with code in it won't quote the code.
 
Old 09-04-2010, 03:34 AM   #19
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 893

Original Poster
Rep: Reputation: 119Reputation: 119
Well Just an update. I wrote my own version of a multiplier. Cheap and cheesy but moving along.

Code:
// This is a mathmatical program for simple multiplication.
#include <iostream>
// Receiving a and b and turning a into firstNumber and b into secondNumber.
int mulTiply (int firstNumber, int secondNumber)
{
    using std::cout;
    using std::endl;

    // announcing to the user of the status of the equation
    cout << endl;
    cout << "First Number " << firstNumber << " and second number " << secondNumber << " Now being multiplied.\n";
    cout << endl;
    cout << "Please Wait....";
    cout << "Now Returning your value\n";
    cout << endl;

    // Returning firstNumber(a) and secondNumber(b) back to main for output.
    return (firstNumber * secondNumber);
}

int main()
{
    using std::cout;
    using std::cin;
    using std::endl;

    // Opening statement asking user what he would like to multiplied.
    cout << "Type your two numbers to be multiplied.\n";
    cout << "It must only include the numbers on each line.\n";
    // a = number
    // b = number
    // c = output
    int a, b, c;

    cout << endl;
    cout << "First Number: ";
    cin >> a;
    cout << "Second Number: ";
    cin >> b;
     // calling Function Add for addition and return.
     c = mulTiply(a,b);

    // multiply function return the value of c.
    // Announcing to the user the = of c
    cout << a << " * " << b << " = " << c << endl;
    cout << "Thank you for choosing JC Multiplication Program!\n";

    return 0;
}
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Learning Shell script new.2.linux Linux - Newbie 4 07-02-2010 09:40 AM
E-learning learning, VLS want to help other learn? scheidel21 General 0 04-06-2010 11:19 AM
Help needed learning to write a shell script for logons nistur Linux - Networking 8 10-02-2004 02:34 AM
learning Shell script ???? Atrocity Programming 3 02-02-2003 01:49 PM
Learning to script robbage Programming 6 12-26-2002 01:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration