LinuxQuestions.org
Visit Jeremy's Blog.
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 08-29-2004, 02:17 PM   #1
inescapeableus
Member
 
Registered: Feb 2004
Location: Canada
Distribution: GNU/Linux Debian (Etch)
Posts: 319

Rep: Reputation: 30
C++ Newbie Question


Hello I have hit a road block Iam trying to teach myself C++ with some books etc. I was told to write a program but everytime I try to compile I get the following error.

cout << farhrenheit << end1; the application is telling me that it is not declared

If you can please help me I am really dumbfounded. thanks again.
 
Old 08-29-2004, 02:23 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Quote:
cout << farhrenheit << end1; the application is telling me that it is not declared
Check you program for typos. Also end1 should be endl (That is a small L as in endline not a 1 )
 
Old 08-29-2004, 02:44 PM   #3
inescapeableus
Member
 
Registered: Feb 2004
Location: Canada
Distribution: GNU/Linux Debian (Etch)
Posts: 319

Original Poster
Rep: Reputation: 30
Ok I went over it, I corrected it but I still get error, this is what I have

//
// Program to convert temperature from Celsius degree
// units into Fahrenheit degree units:
// Fahrenheit = Celsius * (212 - 32)/100 + 32
//
#include <cstdio>
#include <cstlib>
#include <iostream>
using namespace std;

int main (int nNumberofArgs, char* pszArgs[])
{

// enter the temperature in Celsius
int celsius;
cout << "Enter the temperature in Celsius:";
cin >> celsius;

//calculate conversion factor for Celsius
//to Fahrenheit
int factor;
factor = 212 - 32;

//use conversion to convert Celsius
//into Fahrenheit values
int fahrenheit;
int fahrenheit = factor * celsius/100 + 32;

//output the results (followed by a Newline)
cout << "Fahrenheit value is:";
cout << farhrenheit << endl;

//wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}

if you can please enlighten me I would appreciate it. Thanks so much
 
Old 08-29-2004, 02:55 PM   #4
LongName
Member
 
Registered: Aug 2004
Posts: 33

Rep: Reputation: 15
int fahrenheit;
int fahrenheit = factor * celsius/100 + 32;

You have 2 lines that declare fahrenheit. on the second one remeove the 'int'

int fahrenheit;
fahrenheit = factor * celsius/100 + 32;

Have fun!
 
Old 08-29-2004, 03:20 PM   #5
inescapeableus
Member
 
Registered: Feb 2004
Location: Canada
Distribution: GNU/Linux Debian (Etch)
Posts: 319

Original Poster
Rep: Reputation: 30
Thanks for repsonding and helping me get my feet wet, I still get an error now, the application highlights this line

cout << farhrenheit << endl;

any thoughts?
 
Old 08-29-2004, 03:23 PM   #6
LongName
Member
 
Registered: Aug 2004
Posts: 33

Rep: Reputation: 15
cout << farhrnheit ...

Spelling error there

Have fun!

Last edited by LongName; 08-29-2004 at 03:25 PM.
 
Old 08-29-2004, 05:00 PM   #7
inescapeableus
Member
 
Registered: Feb 2004
Location: Canada
Distribution: GNU/Linux Debian (Etch)
Posts: 319

Original Poster
Rep: Reputation: 30
Thanks for the response yet again I am not at home so I have not had the chance to correct that to see of that will resolve the issue, but I am sure that it will. This is really painstaking and humorous thanks.
 
Old 08-29-2004, 11:13 PM   #8
inescapeableus
Member
 
Registered: Feb 2004
Location: Canada
Distribution: GNU/Linux Debian (Etch)
Posts: 319

Original Poster
Rep: Reputation: 30
Well I adjusted the error but while I compile it says the following:

c:\documents and settings\owner\my documents\fahrenhiet.cpp(7) : fatal error C1083: Cannot open include file: 'cstlib': No such file or directory
Error executing cl.exe.

When I was instructed to write this program I was told to include the

#include <cstlib>

line, yet it seems to be missing it? Is there something that I should include? Thanks again
 
Old 08-29-2004, 11:20 PM   #9
R00ts
Member
 
Registered: Mar 2004
Location: Austin TX, USA
Distribution: Ubuntu 11.10, Fedora 16
Posts: 547

Rep: Reputation: 30
Quote:
Originally posted by inescapeableus
Well I adjusted the error but while I compile it says the following:

c:\documents and settings\owner\my documents\fahrenhiet.cpp(7) : fatal error C1083: Cannot open include file: 'cstlib': No such file or directory
Error executing cl.exe.

When I was instructed to write this program I was told to include the

#include <cstlib>

line, yet it seems to be missing it? Is there something that I should include? Thanks again
That should be:

#include <cstdlib>

I don't mean to sound rude, by why don't you check for typos before you post your problems? Its mildy irritating to hear people tell you "its a typo" numerous times.
 
Old 08-29-2004, 11:44 PM   #10
inescapeableus
Member
 
Registered: Feb 2004
Location: Canada
Distribution: GNU/Linux Debian (Etch)
Posts: 319

Original Poster
Rep: Reputation: 30
Yeah I know I am sorry for asking again, I should go over it a little better I just am such a newbie I went over it (to me it looked fine) but I suppose I was wrong, thanks for your critic.
 
  


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
Very Newbie Question. Please Help imfineru Linux - Newbie 8 08-20-2005 05:09 AM
Apache newbie question.. (very newbie question) tarballed Linux - Newbie 1 02-07-2003 08:41 PM
RE: Suse 8.0 hardware question {newbie question, pls help} Radiouk Linux - Distributions 2 06-04-2002 12:53 PM
RE: Samba question pls help {Newbie question} Radiouk Linux - Networking 4 06-03-2002 06:40 PM
Security question {newbie question} Radio Linux - Security 3 05-17-2002 06:32 PM

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

All times are GMT -5. The time now is 08:14 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