Answer to Question #185957 in C++ for shuvo

Question #185957

Given the variable n of type int and the variable s is of type string, translate the following conditions to C++.

1. n is at least 10.

2. s begins and ends with the same letter.


1
Expert's answer
2021-04-28T23:28:17-0400
#include<bits/stdc++.h>


using namespace std;
int main()
{
  int n;
  string s[100];


  cout<<"Enter a number: "<<endl;
  cin>>n;


  if (n < 10)
  {
    cout<<"Enter a number greater than 10";
    cin>>n;
  }


  cout<<"Enter a string: "<<endl;
  cin>>s[100];


  if (s[0] != s[-1])
  {
    cout<<"String has to be begin and end with same letter";
    cin>>s[100];
  }

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS