what am i doing wrong?

what am i doing wrong?

Post by hackerchris592 on Fri Apr 27, 2012 7:21 pm
([msg=65991]see what am i doing wrong?[/msg])

Code: Select all
//
// Program to convert temperature from Celsius degree
// units into Fahrenheit degree units:
// Fahrenheit = Celsius * (212 - 32)/100 + 32
//
#include <cstdio>
#include <cstdlib>
#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 factor to convert Celsius
// into Fahrenheit values
int fahrenheit;
fahrenheit = factor * celsius/100 + 32;
// output the results (followed by a NewLine)
cout << “Fahrenheit value is:”;
cout << fahrenheit << endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system(“PAUSE”);
return 0;
}


my compiler is saying
Code: Select all
cout << “Enter the temperature in Celsius:”;
is wrong
im using dev-c++
hackerchris592
New User
New User
 
Posts: 5
Joined: Thu Apr 26, 2012 10:54 pm
Blog: View Blog (0)


Re: what am i doing wrong?

Post by pretentious on Fri Apr 27, 2012 8:57 pm
([msg=65993]see Re: what am i doing wrong?[/msg])

hackerchris592 wrote:
Code: Select all
cout << “Enter the temperature in Celsius:”;


“ does not equal "
Code: Select all
cout << "Enter the temperature in Celsius:";

is what you want.
Goatboy wrote:Oh, that's simple. All you need to do is dedicate many years of your life to studying security.

IF you feel like exchanging ASCII arrays, let me know ;)
pretentious wrote:Welcome to bat country
User avatar
pretentious
Contributor
Contributor
 
Posts: 705
Joined: Wed Mar 03, 2010 12:48 am
Blog: View Blog (0)


Re: what am i doing wrong?

Post by LoGiCaL__ on Sat Apr 28, 2012 2:53 am
([msg=65994]see Re: what am i doing wrong?[/msg])

Changed it a little as I was bored. Was using g++. You should indent your code and declare your variables in a more centralized location so it is easier to read for other people.

Code: Select all
//
// Program to convert temperature from Celsius degree
// units into Fahrenheit degree units:
// Fahrenheit = Celsius * (212 - 32)/100 + 32
//
#include <cstdio>
#include <cstdlib>
#include <iostream>

int main(int nNumberofArgs, char* pszArgs[])
{
    char terminate = 'y';
    int celsius, factor, fahrenheit;
    int amount;

    std::cout << "Enter how many temperatures you would like to convert: ";
    std::cin >> amount;

    for( ; amount > 0; --amount)
    {
        // enter the temperature in Celsius
        std::cout << "Enter the temperature in Celsius:";
        std::cin >> celsius;

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

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

        // output the results (followed by a NewLine)
        std::cout << "Fahrenheit value is:";
        std::cout << fahrenheit << '\n';

        // wait until user is ready before terminating program
        // to allow the user to see the program results

    }

    return 0;

}
User avatar
LoGiCaL__
Addict
Addict
 
Posts: 1063
Joined: Sun May 30, 2010 12:33 pm
Blog: View Blog (0)



Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests