Hey guys, thank for the help before and maybe you can help me a little more :-).
Here is the question they are asking...
"Write a statement that reads a floating point (real) value from standard input into temperature. Assume that temperature. has already been declared as an double variable."
I been trying to figure out what it means. I tried scanf, but just get some error message. Any help would be great. Thanks.
Oh btw this isn't a homework question. I been using this site to help me learn C++ the site is turingscraft.
12 9830 horace1 1,510
Recognized Expert Top Contributor
Hey guys, thank for the help before and maybe you can help me a little more :-).
Here is the question they are asking...
"Write a statement that reads a floating point (real) value from standard input into temperature. Assume that temperature. has already been declared as an double variable."
I been trying to figure out what it means. I tried scanf, but just get some error message. Any help would be great. Thanks.
post your code an we can try to figure out what is wrong
post your code an we can try to figure out what is wrong
Well, I tried these.. -
-
printf("%f",temperature);
-
-
and I tried
-
-
scanf("%f",temperature);
-
-
and I even messed around and gave temperature a value of 10.
-
I just don't really understand what they are asking for exactly. I hope that helps...
horace1 1,510
Recognized Expert Top Contributor
Well, I tried these.. -
-
printf("%f",temperature);
-
-
and I tried
-
-
scanf("%f",temperature);
-
-
and I even messed around and gave temperature a value of 10.
-
I just don't really understand what they are asking for exactly. I hope that helps...
when scanf() converts characters into a numeric value it has to return that value into the variable. To do this it need the address in memory of the variable. To pass the address you use the & (address of operator), e.g. -
scanf("%f",&temperature); // ** & added
-
when scanf() converts characters into a numeric value it has to return that value into the variable. To do this it need the address in memory of the variable. To pass the address you use the & (address of operator), e.g. -
scanf("%f",&temperature); // ** & added
-
Hello, I also had tried the & and I believe I got the error "Suggestion : You changed temperature, but did not read a value into it."
So would I have to put something like temperature = 10 is that "reading a value into it."
horace1 1,510
Recognized Expert Top Contributor
Hello, I also had tried the & and I believe I got the error "Suggestion : You changed temperature, but did not read a value into it."
So would I have to put something like temperature = 10 is that "reading a value into it."
try this program which reads a value from the keyboard and returns it into the variable temperature -
#include <stdio.h>
-
-
int main()
-
{
-
float temperature;
-
scanf("%f",&temperature); // ** & added
-
printf("%f\n",temperature);
-
system("pause");
-
}
-
try this program which reads a value from the keyboard and returns it into the variable temperature -
#include <stdio.h>
-
-
int main()
-
{
-
float temperature;
-
scanf("%f",&temperature); // ** & added
-
printf("%f\n",temperature);
-
system("pause");
-
}
-
Hello, that works in my c++ program, but not for the website. I have to put
[code]
scanf("%f",&tem perature);
printf("%f\n",t emperature);
[code\]
You changed temperature, but did not read a value into it.
Unexpected identifiers: printf
Write a single statement, performing the input as directed.
The site asks
Write a statement that reads a floating point (real) value from standard input into temperature. Assume that temperature. has already been declared as an double variable.
I know scanf and printf does what the first line asks for, but could've the site have a grammar error or temperature. <<notice the period must be included in the code?
I'm sorry if this is confusing as I am confused as well.
horace1 1,510
Recognized Expert Top Contributor
what exactly are you trying do, i.e. what is the specification of the program? what website are you talking about?
what exactly are you trying do, i.e. what is the specification of the program? what website are you talking about?
Hello, the website I am using is www.turingscraf t.com
You have some sort of instant message program I can send you my print screen of or I'll just find a website to host it.
Thanks again!
After a few hours of research, I figured out the correct code: - scanf("%lf",&temperature);
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Sven Kobow |
last post by:
Hello,
I'm not yet a python programmer but a python user. I faced a problem
with tiny fonts in a wxPython app on a GNU/Debian system. Under Gentoo
Linux the fonts are displayed in a normal readable size. Only on that
Debian system fonts in the whole app are rather tiny. I spend quite a
long time googling for a solution and found several hints on font
problem issues in wxPython but none fitted to that mentioned above. Does
anybody has a...
|
by: Mel |
last post by:
i would like to place a tiny image on the top-left corner of all screens and
on clicking the image to to http://www.somewhere.com url
can you please help ?
|
by: drj0nson |
last post by:
Without getting too mathematical : how do you print/handle big numbers?
for ( int i = 1 ; i < 10 ; i ++)
cout << (123456789 << i) << endl;
246913578
493827156
987654312
1975308624
-344350048
|
by: Pieter Linden |
last post by:
The answer to this one is probably "test it yourself and find out!",
but I'll ask anyway. Pursuant to my previous question - sending
separate recordsets to Word using the CreateTableFromRecordset code
from ADH2000...
I will be opening like 8 recordsets {one for each building, and there
are 8). Would I be better off or is there anything to be gained by
opening one recordset of the query with _all_ the records in it,
filtering that, and...
|
by: Werner Nussbaumer |
last post by:
Hello
I am searching for a version of the Tiny C compiler for Windows 32. I
downloaded a version from http://fabrice.bellard.free.fr/tcc/ but the
make command displayed error messages:
P:\DEVELOP\c2\TCC-09~1.20>make
MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp.
Error makefile 5: Command syntax error
Error makefile 13: Command syntax error
| |
by: Justin Naidl |
last post by:
A group of friends and I are doing a RPG (role-playing game) maker for a
school project. It occured to us, however, that if you want the user to be
able to have almost complete control over the contents of his/her game, that
you would end up with a tiny executable and a huge datafile. We wanted to
keep clear of this as disk accesses take a lot of time to do and there would
be a huge load of them to do this part. We could very easily...
|
by: soeren |
last post by:
Hello,
two days ago I stumbled across a very strange problem that came up when
we were printing tiny double numbers as strings and trying to read them
on another place. This is part of an object serialisation framework
that cannot be done in binary format currently, so please no comments
about this ,-))
It took quite some time to shrink down the problem but it looks like
that C++ does not behave well in regards to very tiny numbers.
|
by: Martijn Mulder |
last post by:
I want to implement a tiny window in my application, one that you typically
invoke via the menu-option Window -Toolbar. It must be floating, not
restricted to the client area of the controlling form. It has a tiny
close-button on the right-hand corner. How do I implement this?
|
by: rtk |
last post by:
I'm looking for information on building a tiny/small/minimalist/
vanilla python interpreter. One that implements the core language and
a few of the key modules but isn't tied to any specific operating
system.
I guess I'm asking for the smallest subset of the standard Python
source code files that is necessary to get a working interpreter using
a plain C compiler.
Is this even possible? If so, has someone done it already? I've
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |