Write a c++ program using string function that will accept the course
abbreviation as input value and it will display the corresponding
college.
//This code tested by Lunix online compiler but building and running all OS
//Use internet we can add a lot of abbr.
#include <iostream>
#include <string.h>
#include <iomanip>
using namespace std;
int main()
{
//USE GOOGLE will find pair value and push in to programm
//We can use //sitehttps://www.allacronyms.com/course/abbreviations/colleges/2
//for add or change ABR and college
char abr[][50]={"ACAP","ACE","ACEM","AEC","ASFC"
,"BCET","BCOT","CBC","CCC","CCE","CET","ESDC","GC","GCD","\0"};
char colg[][50]={"Australian College of Applied Psychology",
"Adhiyamaan College of Engineering","Aravali College of Engineering and Management","Assam Engineering College",
"Ashton Sixth Form College","Bengal College of Engineering & Technology","Basingstoke College of Technology","Community Business College","Coffeyville Community College","College of Continuing Education","European Security and Defence College","General College","Griffith College Dublin"};
char str[50];
cout<<"Please input abbreviation for searching: ";
cin>>str;
//if user input small register change to UPPER
for(unsigned i=0;i<strlen(str);i++)
str[i]=toupper(str[i]);
//compair with base abbr
bool is=false;
for(unsigned i=0;i<14;i++)
{
if(strcmp(str,abr[i])==0)
{
cout<<"Found: "<<colg[i]<<endl;
is=true;
break;
}
}
if(!is)
{
cout<<"Sorry we can't found this abbraviation Please search to GOOGLE\n";
}
return 0;
}
Comments
Leave a comment