C++ :: Temperature Converter With A Menu - Printing Right Output

Nov 13, 2014

I'm trying to make a simple temperature converter with a menu that lets users pick which conversion to perform. But, it won't seem to print the right conversion. It just prints the same temperature that I inputted.

for example:

#include <iostream>
using namespace std;
//prints the menu
void userMenu(){
cout << "Temperature Calculator" << endl << endl;

[Code] .....

View 2 Replies


ADVERTISEMENT

C++ :: Temperature Converter From Imperial To Metric - For Loop

Nov 26, 2013

I've been doing some practice programming challenges and I am currently making a temperature converter from Imperial to Metric.

My approach was to make it as simple as possible but it must display correctly and use decent I/O manipulations corresponding with how high the counter is.

This is what I have come up with, and everything seems to work fine for a base where I could possibly add more code to include user input, but before I go to that one step further I'd just like to know if the approaches I have taken to using iomanip is OK practice and I haven't done any serious no-nos, as I haven't seen any code from example videos that people make that includes this!

Here's the code:

#include <iostream>
#include <iomanip>
using namespace std;
int main()

[Code] ....

The reason I added the IO manipulators is because I couldn't stand seeing everything not lining up, it looked very sloppy and unprofessional..

View 2 Replies View Related

C++ :: Temperature In Celsius And Fahrenheit - No Output

Mar 8, 2013

The program should create two integer variables for the temperature in Celsius and Fahrenheit. Initialize the temperature to 100 degrees Celsius. In a loop, decrement the Celsius value and compute the corresponding temperature in Fahrenheit until the values are the same. But for some reason i either get no output or an out put of -43.

#include <iostream>
using namespace std;
int main() {
int celsius;
int fahrenheit;

fahrenheit = 0;
celsius = 100;

[Code] ....

View 1 Replies View Related

C Sharp :: Maintain Temperature Of Grill And Measure Temperature Using Probe At 12 Points

Jan 16, 2013

I have to write a program for a restaurant and their food has to be cooked on a hot sheet of metal and too cook their burgers properly I must keep a maintain temp of 400 F, for the grill and to measure the temperature using a probe at 12 points, there are 3 elements with 3 points on them

View 2 Replies View Related

C :: Storage Types / Formatted Input / Output / Processing A Menu

Feb 1, 2013

where to start and how it should be structured. how I should go about writing this program, like should i make functions, pointers, etc. And to display the menu, is it easiest to just use printf statements or is there something more efficient.

View 3 Replies View Related

C++ :: Output Is Printing Twice With Overloaded Operators

Feb 16, 2013

I'm having an issue with output, luckily everything else works!! I'm working with Mixed Numbers and operations on them. So, here's the code I'm testing with:

int main() {
Mixed m1(5), m2(1,1,1), m5(2,2,3);
cout << "m1+m2= " << m1+m2 << endl;
cout << "m1 + 10=" << m1+10 << endl;
cout << "m1 - 10=" << m1-10 << endl;
return 0;
}

And here is the output for that code:

File name: fract.h

#ifndef fract_H
#define fract_H

#include <iostream>
using namespace std;

const int DEFAULT_VAL = 0;

[Code] ....

View 2 Replies View Related

C++ :: Printing Function Output To A File?

Oct 11, 2013

I have to convert a binary value from an input file (the name of which is given by the user) and then convert the binary to decimal value and print that in an output file.

Right now it is compiling just fine with no error messages, but when I run the program, it doesn't end or print to the output file.

Here is my code at the moment:

#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <fstream>

[Code].....

View 2 Replies View Related

C :: Printing String Yields Strange Output

Feb 23, 2015

I'm reading in a string from the command line into a char array followed by a series of ints which are read into an int array.

The command line

Code: lab3 word word word 0 0 2 3 results in the following output:

Code: Word: .N=▒
Number of Words: 0
Word: .N=▒word word word
Number of Words: 3
Num: 0
Num: 0
Num: 2
Num: 3

Here is the source code:

int main(int argc, char *argv[]){
if(argc < 2){
//command line must have at least three arguments (one
//char, one integer)
printf("Error: invalid number of arguments

[Code] .....

Where is the .N=▒ coming from?

View 3 Replies View Related

C++ :: Printing To Multiple Files Because Output Is Too Large?

Apr 18, 2013

I have managed to make a program that permutates a string with repetition.

I ran it to permutate "abcdefghijklmnopqrstuvwxyz1234567890" with a limit of 5 characters.

This took a little over 5 hours for my pc to process this and I ended up with a .txt 403MB in size. Needless to say I am unable to open this .txt in notepad without Notepad.exe not responding and me having to end the process.

So what I want to do is modify my code to break up the output in to several files rather than one. Possibly all permutations starting with a in one file, b in another, etc.

Here is my current code:
#include <iostream>
#include <string>
#include <sstream>

[Code]....

As you can see it currently appends permutation.txt with all output. I would like it to make files like this permut_5char_a.txt, permut_5char_b.txt, etc.

View 12 Replies View Related

C++ :: Menu Program Broken Down Into Series Of Calls To Function For Each Of Menu Items

Aug 19, 2013

I am trying to write a menu program that will be broken down into a series of calls to function for each of the menu items. Two of the menu items will be simple programs which I wrote.

I want two of the functions to run one of the two programs I am trying to include as items in the menu.

So far I am only familiar with variables, loops, if statements, and I just learned how to write functions.

The problem I am have is that I don't quite understand how to write a function that will run one of the two programs. Also I am having a hard time writing the program in away that would allow the user to select the menu items.

View 2 Replies View Related

C :: Program Based On Menu System - Option To Go Back To A Previous Menu

Apr 7, 2014

I'm creating a program that is based on a menu system. Basically each menu is its own user-defined function. The problem is at each menu you can input 'b' to go to the previous menu. I just have it call the function of that menu.

However, do the functions need to complete themselves eventually? If I just keep calling functions will I just keep going further and further deeper into ever running functions?

If so how do I avoid this and yet keep the option to go back to a previous menu/function?

View 2 Replies View Related

C/C++ :: Creating A Menu That Will Return The Menu After A Selection

Apr 7, 2014

This is what I have so far, it gives me a nice menu to select from and it all works but after I make a selection it closes the program. I tried to return to it but it won't work for me

#include <stdio.h>
int main() {
int choice;
int deposit;
int balance = 500; {
printf(" CHOOSE FROM THE FOLLOWING

[code]....

View 14 Replies View Related

Visual C++ :: Enable / Disable Menu Item 2 In OnUpdate Handler Of Menu Item 1?

Sep 15, 2014

I have two menu items. When item 1 is disabled, I want item 2 to be disabled as well. In the OnUpdate handler of menu item 1, I have tried to use "t_pMenu = pCmdUI->m_pMenu;", "t_pMenu = pCmdUI->m_pSubMenu;" and "t_pMenu = pCmdUI->m_pParentMenu;" but I always get NULL t_pMenu. How can I achieve this purpose?

Code:
void CDummyView::OnUpdateMenuItem1(CCmdUI* pCmdUI)
{
if(m_bShowMenuItem1) {
pCmdUI->Enable(TRUE);

[Code]....

View 14 Replies View Related

C++ :: Check CPU / RAM USAGE / Temperature

Nov 1, 2014

I want to make an application that will check CPU/RAM USAGE and CPU TEMPERATURE and if it meets some requirements it will restart your system or do something else..but my problem is:

1) How do i get that info? (i know that in VB.net there is an easy way) but in C/C++ or Java?

2) Is it possible though a C program to execute a command and parse that info to your program?

I am mainly interested for windows but i need also info for linux too..

View 4 Replies View Related

C++ :: Displaying Celsius Temperature?

Dec 1, 2014

I am using Microsoft Visual C++ 2010 Express.

This is my Algorithm. [URL] ....

#include <iostream>
#include <iomanip>
using namespace std;
//function prototypes
int getFahrenheit();
double calcCelsius(int tempF)

[Code] ....

for some reason it keeps giving me a
Error C2144: syntax error: 'int' should be preceded by ';' on line 16 column 1
Error C2143: syntax error: missing ';' before 'return' on line 34 column 1
IntelliSence: expected a ';' on Line 34 Column 2

I have tried to fix both of these problems and no matter what I do I either get more errors or they wont go away...

View 5 Replies View Related

C :: Fahrenheit And Celsius Converter?

Feb 5, 2013

I know my current program will not compile. How can I store the the start temperature so it can be used again in the final printf statement "start degrees Fahrenheit is converted Celsius."?

Note - I want to use the float data type for precision.

Code:

//THIS PROGRAM WILL CONVERT TEMPERATURES BETWEEN DEGREES FAHRENHEIT AND DEGREES CELSIUS
#include <stdio.h>
int main(void)

[Code].....

View 4 Replies View Related

C :: Binary To Decimal Converter

Feb 26, 2013

I'm trying to make a program that takes up to a seven digit binary number and converts it to its decimal equivalent. I'm still a beginner, so this might be a simple question but how do I stop the user from entering anything but 1s and 0s? This means no decimals or numbers other than 1 or 0.I already made it so it won't accept anything below 0 or above 1111111.

View 1 Replies View Related

C++ ::  Binary To Decimal Converter

Mar 15, 2013

#include <iostream>
#include <math.h>
using namespace std;
int main() {
int N=0, counter=0, counter1=0,counter2=0, temp=0, temp1=0,dec=0,result=0, moder=0;

[Code] .....

This is Binary to Decimal Converter. It's not working. Although Dry Run of this program works fine.

View 4 Replies View Related

C/C++ :: Roman Numeral Converter?

Dec 23, 2013

I am writing a program that converts arabic numbers into roman numerals.

Quote Write a program that asks the user to enter a number within the range of 1 through 10. Use a switch statement to display the Roman numeral version of that number.

Input Validation: Do not accept a number less than 1 or greater than 10.

Prompts And Output Labels. Use the following prompt for input: "Enter a number (1 - 10): ". The output of the program should be of the form "The Roman numeral version of A is R" where A is the Arabic numeral entered (1,2,3,...) and R is the all-capitals form of a Roman numeral, such as VII.

View 14 Replies View Related

C++ :: Calculate Wind Chill Temperature

Feb 4, 2014

Here is my problem:

Wind Chill = 35.74 + 0.6215T – 35.75(V^0.16) + 0.4275T(V^0.16)

Note: Windchill Temperature is only defined for temperatures at or below 50 degrees F and wind speeds above 3 mph. Bright sunshine may increase the wind chill temperature by 10 to 18 degrees F.

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;
double windChillFactor (const double &v, const double &t)

[Code] ....

View 3 Replies View Related

C/C++ :: Take Temperature In Fahrenheit And Convert It Into Centigrade

Feb 10, 2015

I am trying to write a program where i take temperature in Fahrenheit and convert it into centigrade. I keep getting this error "The program '[5980] lab3.exe: Native' has exited with code 0 (0x0)."

My Code is :

#include <iostream>
using namespace std;
int main() {
double fahrenheit, centigrade;
cout << "Enter the temperature in Fahrenheit: ";
cin >> fahrenheit;
centigrade = (5/9)(fahrenheit-32);
cout << "The Temperature in Centigrade is " << centigrade << endl;
return 0;
}

View 4 Replies View Related

C :: Integer / Character Converter To Binary

May 23, 2013

I wrote this code purely for educational purposes. It also learn more about how exactly things look in memory. code I have right now ( I will likely add more and change it in the future) .....

Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>

[Code].....

View 7 Replies View Related

C :: Decimal To Binary Converter (8-bits)

Sep 9, 2014

I was trying to program an decimal to binary converter (8-bits) in C. I am a complete beginner so I tried to put the 1's and 0's of the binary number as they come without reversing the order for beginning. I have seen example on the internet but didn't understand them so I decided to write it as I understood it. So, I typed the code as shown below:

Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
int number;
int BitNum[8], x;

[Code] ....

The problem with the code is that if binary form has 0s in it then program displays a random number instead of a 0. For example if decimal is 7, it should print out 11100000 but it displays only 111(and some stupid numbers instead of 0). I have tried to solve it but failed.

View 7 Replies View Related

C :: Fahrenheit To Celsius Scale Converter

May 28, 2014

One of the questions requires writing up a code, that converts Fahrenheit scale to Celsius scale.

The relation between temperature in ◦ C and ◦F is given by the formula:

◦C = 5/9 . ( ◦F - 32 )

Write a program that prints a table (just two columns without any borders) with temperature in ◦F and ◦C for temperatures between 0 and 300 ◦F in steps of 20◦. Compile and run your program. I wanted to approach this problem via arrays and for loops, and I wrote up this

Code:
#include<stdlib.h>
#include<stdio.h>
int main() {
// begin main()
// units
double[] celsius = new double[ 16 ];
double[] fahrenheit = new double[ 16 ];

[Code] ....

Now when I'm trying to compile that, the compailer throws an error which makes absolutely no sense to me.

Code:
fahrenheitCelsius.c: In function ‘main’:
fahrenheitCelsius.c:18:9: error: expected identifier or ‘(’ before ‘[’ token
double[] celsius = new double[ 16 ];

[Code] ....

View 7 Replies View Related

C++ :: Binary To Grey Code Converter?

Jun 12, 2014

I wrote a program that converts Binary code to Grey code. It works, but I feel like it's highly inefficient. I've also been trying out Project Euler, but I seem to always turn to using vectors whenever solving a problem.

/* Binary to Grey Code Converter */

#include <iostream>
#include <vector>
using namespace std;
// Global Variables (I'd like to not use them because I've been told it's bad practice)
static int numDigits;
int digit;
vector<int> bin;

[Code] .....

View 1 Replies View Related

C# :: Font Converter Style Parameter?

Sep 1, 2014

I need to convert a string into a Font object. I'm trying to use the Font Converter but I don't see support for the font Style. I need to save a font to a string and back again using the font name, size and style.

Font font1 = (Font) converter.ConvertFromString("Arial, 12pt");

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved