Can anyone give me a C code that will print out the first th
Can anyone give me a C++ code that will print out the first three first characters of char array to screen please
Solution
Solution.cpp
#include<iostream>//header file for input output function
using namespace std;//it tells the compiler to link std namespace
int main ()
{//main function
char name [100];//variable declaration
cout <<\"Enter your first name: \";
cin >> name;//key board inputting
cout <<\" The first three characters of a char array are :\" ;
for(int i=0;i<3;i++)
cout<<name[i];//retriving frist three character of char array
return 0;
}
output
Enter your first name: MichialPhlip
The first three characters of a char array are :Mic
