1. Program that prints a text of 4 lines consisting of characters, integer values and floating point values using cout statement.

Chapter 4: 

Input And Output

Programming Exercise

Problem # 1:

Write a program that prints a text of 4 lines consisting of characters, integer values and floating point values using cout statement.

Solution:

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    char c='A';
    int i=100;
    float f=3.14;
    cout<<"Welcome to programming!"<<endl;
    cout<<"Character Value: "<<c<<endl;
    cout<<"Integer Value: "<<i<<endl;
    cout<<"Floating Point Value: "<<f<<endl;
    return 0;
}

Code Screenshot:

Chapter 4, Coding tutorial, Computer Science, CPP Basics, Exercise Solution, Input and Output, IT Series, Object Oriented Programming using C++, Programming for beginners, Programming Tutorial

Output:

Chapter 4, Coding tutorial, Computer Science, CPP Basics, Exercise Solution, Input and Output, IT Series, Object Oriented Programming using C++, Programming for beginners, Programming Tutorial

Let me know in the comment section if you have any question.

Previous Post:
1. Program that asks the user to enter a number of gallons, and then displays the equivalent in cubic feet.

Comments