Question

Intreductien: This assignment helps you to reinforce the topics discussed in the class including a) Variables and data types,
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.

#include <iostream>

using namespace std;

int main()
{
    double Tc,velocity;// Declaring variables
    cout<<"Enter the temperature: "; // Asking for user input
    cin>>Tc;
    velocity = 331.3+0.61*Tc;// Calculating velocity
    // Printing output
    cout<<"At "<<Tc<<" degrees Celcius the velocity of sound is "<<velocity<<" m/s.";
    

    return 0;
}

Enter the temperature: 0 t 0 degrees Celcius the velocity of sound is 331.3 m/s. ...Program finished with exit code 0 Press E

2.

Expression Result
3+4-5

=7-5

=2

4+4*3/6

=4+12/6

=4+2

=6

6+12*2-8

=6+24-8

=30-8

=22

6+12*(2-8)

=6+12*(-6)

=6-72

=-66

(19-3)*(2+2)/4

=16*4/4

=64/4

=16

3.

cin>>myString1; would read single word till space.

cin.get(myChar1); would read character after "This" which is space here.

cin>>myChar2; would read single character 'i'

getline(cin,myString2); would read rest of the line.

myString1 myChar1 myChar2 myString2
This single space i s my first C++ program
Add a comment
Know the answer?
Add Answer to:
Intreductien: This assignment helps you to reinforce the topics discussed in the class including a) Variables...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT