Write a program to convert a measurement in centimeters to inches. The numbers of centimeters should be read as input. Define int variable for centimeters, inches, and feet. Convert the centimeters to inches, then convert the inches to feet and inches (use the % operator). Print the distance in all three units. There are 2.54 centimeters in each inch and 12 inches in each foot.
I am new to c++, and I have been going through some basic code to get used to the syntax etc. I have encountered a compiling issue with my current code. The purpose of this code is to convert feet and inches into meters and centimeters.
#include <iostream> #include <cmath> using namespace std; int main () { <<<xcode is saying I have an expected expression on this blank line>>> double feet1, inch1, inch2, meter1, centimeter1;
cout << "Please enter a length in feet and inches " << endl; cin >> feet1 >> inch1 >> ;
I have tried rewriting the #include through int main () expressions, I've tried copy/pasting the lines from other pieces of code...
I have to write a code to convert centimeters to yards feet and inches i have the code wrtten up and keep getting 2 errors saying im missing a ; before << but im not sure why ?
#include <iostream>//For cin and cout using namespace std; int main(void) { doublecentimeters; //INPUT
I need to write this program (shown below) for class but i'm not sure how to print out a table?
Write a program to display a centimeters-to-inches conversion table. The smallest and largest numbers of centimeters in the table are input values from the user. Your table should give conversions in 10-centimeter intervals. One centimeter equals 0.3937 inches.
Here is my code so far
Code:
#include <stdio.h> #include <stdlib.h> int main() {
I am attempting to write a simple C program, in which the user is asked to input their name and height in inches and the output is the user's height in centimeters.
I have attached my program and what happens when I try to run it.
I was given an assignment to enter two sets of numbers for yards, feet, and inches, and then add them together and convert it to inches. That part of the program is correct, but now I need to calculate the area. It is a working program, but my final answer is in inches, and it is supposed to be in yards, feet, and inches. How do I convert the calculated inches back to yards, feet, and inches?
Code: typedef struct { int yards; int feet; float inches;
This program must take user input(from stdin) that contains both a number and then a punctuation character, either a single quote(') or double quote(") that specifies feet or inches. It keeps prompting the user to enter a length until the user enters the sentinel value of 0. For example:
Enter a measurement and unit: 1' Enter a measurement and unit: 2" Enter a measurement and unit: 0 Total: 14 inches
The ultimate goal of this program is to then write an Assembly language program that is structurally similar and makes use of these 4 functions:
void printStr(char *) Arguments: edi = address of null-terminated string to print Returns: Nothing
[Code] ...
So here is what I have:
int main() { char value[50]; char *end; int sum = 0; long conv; while(conv !=0)
[Code] .....
I was told to use fgets instead of scanf for for stdin to parse the number and the quotation marks. I think I converted the number from string to integer correctly with strtol, but I really do not know how to obtain the (") or (') from user input so the program knows whether to convert the number to feet or just inches. No matter what I type in, even if it's without a quotation mark, it still multiplies the number by 12. In the IF and ELSE IF statement, it should state
I have my program all but done, but I can't get past this last part. I need to have the user input their height as a decimal. For example someone who is 5 foot 11 inches would need to enter it as 5.11, then I need to display there height in inches. Since i'm 5 foot 11, I would need to enter 5.11, then have it display 71 inches.
Exerted by the rider's foot yet not exceed the stress placed on the crank arm's sprocket attachment, is provided by this formua:
r^3 = d*p/s*π
r is the radius of the cylindrical rod in inches. d is the length of the crank arm in inches. P is the weight placed on the pedal in lbs. S is the stress in lbs/in2
Using this information, design, write, compile, and execute a C++ program that computes the value of r for a crank arm that is 7 inches long, accommodates a maximum weight of 300 lbs, and is able to sustain a stress of 10,000 lbs/in2.
I was assigned a problem involving using buffer overflow to access a different function than I was supposed to. I was able to figure out how to modify the point in stack that I need to change using a printf statement, however what doesn't make sense is that when I use the input "AABBCCDDEEFFGGx86x64x00x00" the stack changes to 78363878 I looked up the ascii codes and I assume that it's not converting x86, but using the input x86 instead.
I have written this to convert this .dat file into .txt file but it is not working well. It create one .txt file and also with content but contain some garbage content also .
if we have int x = 5; and we want to convert x which is == 5 to char so for example char number = x doesnot work i understand why , but how to convert it ?
How would you go about converting a decimal value to hex and then do math? Every example of converting decimal to hex that I have seen creates an array and I wouldn't be able to do math if I did that. Something like this.
15 decimal to hex F 17 decimal to hex 11 F hex + 11 hex = 20