A PHP Error was encountered

Severity: Warning

Message: fopen(/var/cpanel/php/sessions/ea-php56/PHPSESSIDrrkj2hn8rkms6od8qf0cog0vvvo9ndho): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 174

Read character array as string using cin in C++
Q:

Read character array as string using cin in C++

0

Read character array as string using cin in C++

We have to character array known as string in C++ using "cin".

In this example, we reading firstName and secondName of a person and printing them.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

#include <iostream>
using namespace std;

int main()
{
	char firstName[30], secondName[30];

	//input values
	cout<<"What is your first name? ";
	cin>>firstName;
	cout<<"What is your second name? ";
	cin>>secondName;

	//printing
	cout<<"Hi "<<firstName<<" "<<secondName<<endl;
	
	return 0;
}

Output

What is your first name? Amit
What is your second name? Shukla
Hi Amit Shukla

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now

A PHP Error was encountered

Severity: Warning

Message: Unknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/var/cpanel/php/sessions/ea-php56)

Filename: Unknown

Line Number: 0