How to use "

Hey there! I'm struggling with adding a singular " to my code on line 28. Is there anyway to make this work without using printf?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>

using namespace std;
  
int main()
{
    float CENTIMETERS_IN_METER;
    float CENTIMETERS_PER_INCH;
    float INCHES_PER_FOOT;

    CENTIMETERS_IN_METER = 0.01;
    CENTIMETERS_PER_INCH = 2.54;
    INCHES_PER_FOOT = 12;
    // 1. Convert feet to inches
    float feet;
    float inches;
    feet = 6.16667;
    inches = feet * INCHES_PER_FOOT;

    // 2. Convert inches to centimeters
    float centimeters;
    centimeters = inches * CENTIMETERS_PER_INCH;

    // 3. Convert centimeters to meters
    float meters;
    meters = centimeters * CENTIMETERS_IN_METER;

cout << "A 6'2 person is " << meters << " meters tall";
}
Never mind, I resolved it!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include <iostream>

using namespace std;
  
int main()
{
    float CENTIMETERS_IN_METER;
    float CENTIMETERS_PER_INCH;
    float INCHES_PER_FOOT;

    CENTIMETERS_IN_METER = 0.01;
    CENTIMETERS_PER_INCH = 2.54;
    INCHES_PER_FOOT = 12;
    // 1. Convert feet to inches
    float feet;
    float inches;
    feet = 6.16667;
    inches = feet * INCHES_PER_FOOT;

    // 2. Convert inches to centimeters
    float centimeters;
    centimeters = inches * CENTIMETERS_PER_INCH;

    // 3. Convert centimeters to meters
    float meters;
    meters = centimeters * CENTIMETERS_IN_METER;

cout << "A 6'2/" person is " << meters << " meters tall";
}
 
cout << "A 6'2\" person is " << meters << " meters tall";
Last edited on
Topic archived. No new replies allowed.