Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Errors in code

Posted on 2004-10-21
Medium Priority
Last Modified: 2012-06-21
Hi everyone,

I am a beginning programmer in C++ learning this on my own with the help from fellow experts-exchange comrades, with two question hoping someone can help.  The first, I would like two get everyone's input on which is the best way to learn the C++ programming language? On your own or in an acedemic environment ?

The second, I am trying to compile this source file taken from Sams teach yourself C++ in 21days Ex.1. p.21 using Borland's C++ Comiler 5.5.1, but i am getting these error messages:

//Exercise 1 ch.1

#include <iostream>

int main()
  int x = 5;
  int y = 7;
  std::cout << "\n";
  std::cout << x + y << " " << x * Y;
  std::cout << "\n";
  return 0;

Warning W8084 Ex1.cpp 10: Suggest parenthesis to clarify precedence in function main()
Error E2451 Ex1.cpp 10: Undefined symbol in function main()
Warning W8004 Ex1.cpp 13: 'x' is assigned a value that is never used in the function main()
Warning W8004 Ex1.cpp 13: 'y' is assigned a value that is never used in the function main()
****1 errors in compile****

Thanks, it's great to have joined a site with so much IT related assistance and information!!!!

Question by:studious01
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 12377029
Either way is acceptable. I learned C in an academic environment, taught myself c++/java/python....
To me, it just helps to have someone around that knows what they're doing to explain things.

Try using parens around the x + y  and x * y  and it will work.  also on that same line, change it from a Y to a y.

Accepted Solution

nagraves earned 200 total points
ID: 12377033
The parens should look like:

std::cout << (x+y) << " " << (x*y);

Author Comment

ID: 12377044
Thanks, nagraves that did!
Just required a little more effort.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question