Thursday, March 25, 2021

String and Integer Input in Modern C++

 A simple program to demonstrate how to declare and use strings and integer data types in C++ programming.

am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.




Program Listing


#include <iostream>



using namespace std;


int main() {


string student_name;

    string school;

string course_year_section;

int age=0;


std::cout << "\n";

std::cout << "\tString and Integer Input in Modern C++";

std::cout << "\n";

std::cout << "\tName : ";

    getline(cin,student_name);

std::cout << "\tAge  : ";

cin >> age;

cin.ignore();

std::cout << "\tSchool : ";

    getline(cin,school);

    std::cout << "Course, Year and Section : ";

    getline(cin,course_year_section);

    

std::cout << "\n\n";

std::cout << "\tDISPLAY RESULTS";

std::cout << "\n\n";

std::cout << "\tName   :" << student_name <<"\n";

std::cout << "\tAge    :" << age <<"\n";

std::cout << "\tSchool  :" << school <<"\n";

std::cout << "\tCourse, Year and Section  :"

<< course_year_section <<"\n";

std::cout << "\n";

std::cout << "\tEnd of Program";

std::cout << "\n";

}



No comments:

Post a Comment