Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9260361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:52:20+00:00 2026-06-18T12:52:20+00:00

I am learning C++ in 11th standard. I don’t have much knowledge about C++

  • 0

I am learning C++ in 11th standard. I don’t have much knowledge about C++

In my college, there is visual studio 2005. I have a project to convert celsius to farenheit. This code works fine in my college in visual studio 2005:

#include <iostream>

int main()
{
   float f,cs;

    cin>>cs;
    cout<<"\n celsius = "<<cs;
    f=1.8*cs+32.0;
    cout<<"f = "<<f;
}

But when I run this code in visual studio 2012 after modifying:

#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
   float f,cs;

   cin>>cs;
   cout<<"\n cs = "<<cs;
   f=1.8*cs+32.0;
   cout<<"f = "<<f;
}

It gives me following errors:

conversion from double to float possible

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:52:21+00:00Added an answer on June 18, 2026 at 12:52 pm

    You are getting a warning, as you multiply 1.8 (which is a double literal) with cs, yielding a double. In C++, if you have an expression with two different types, a type promotion is performed to the type with the largest value range; for double and float this means that cs is converted to double. This is then assigned to a float, which might not be able to represent the full value range of double (float is a 32-bit IEEE floating point number, double is 64-bit.) Hence the warning.

    You can fix this by writing:

    f=1.8f*cs+32.0f;
    

    or by changing f to be of type double.

    Note: Your code is compiling, this is just a warning, not an error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

learning Jquery and integrating with PHP - getting there, but have one last challenge
Learning about SQL datatypes in PL/SQL. I have a question about what datatype the
learning about loops (still a beginner) in VB.net. I have got the below code
Learning Javascript and have a question about global variables. From my reading, most recommend
Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of
Learning about notifyAll made me question something about notify: in a typical situation we
Still learning magento coding. I wonder is there a way I can print out
Learning progaming with symfony is a evolutional process (for me). So, I have to
Learning php! I have a sql database which contains a table called 'images' which
Learning about Explicit Cursors and trying to create my frst one.: SET SERVEROUTPUT ON

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.