Answer to Question #332059 in C++ for hallelu

Question #332059

Write a c++ program using string function that will accept the course

abbreviation as input value and it will display the corresponding

college.



1
Expert's answer
2022-04-22T04:43:49-0400


//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;
}

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