60 704
Assignments Done
97,9%
Successfully Done
In April 2018

Answer to Question #5307 in C++ for anum

Question #5307
write a program which takes the names of5 students(anum,effat,anila,faiza,fiza).store them in an ar ray.now disp[lay the name of the student which have minimum length?
Expert's answer
// StudentName.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "conio.h"
#include <iostream>
#include "string"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
string st[5];
st[0]="anum";
st[1]="effat";
st[2]="anila";
st[3]="faiza";
st[4]="fiza";
int min=st[0].length();
int number=0;
for(int i=0;i<5;i++){
if(st[i].length()<min){
min=st[i].length();
number+=i;
}
}
cout<<st[number];
getch();
return 0;
}

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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions