TRAI

#include <iostream>
using namespace std;
class Phone{
  public:
  int stdCode,exchangeCode,phoneNumber;
  void change(){
    char inputNumber[13];
    cin >> inputNumber;
    int test[13],i;
    for(i=0;i<13;i++){
      test[i] = inputNumber[i];
      test[i]-=48;
    }
    for(i=0;i<3;i++){
      if(test[i]==0) test[i]=91;
      cout << test[i];
    }
    for(i=3;i<13;i++){
      cout << inputNumber[i];
    }
  }
   
};
int main(){
  Phone obj;
  obj.change();
  return 0;
}

3 comments:

  1. y text[i] and input[i] is used and 48 is used

    ReplyDelete
  2. #include
    #include
    using namespace std;

    class phone
    {

    int std,ex,ph;
    char s[13];
    public:
    void change()
    {
    cin>>s;
    int i=1;
    cout<<"91";
    while(s[i]!='\0')
    {
    cout<<s[i];
    i++;
    }
    }
    };
    int main()
    {
    phone ob;
    ob.change();
    return 0;
    }

    why this code is only 66% evaluated

    ReplyDelete
    Replies
    1. #include
      using namespace std;
      class Phone
      {
      int std,ex,ph;
      char s[13];
      public:
      void change()
      {
      cin>>s;
      s[0]='1';
      cout<<"9";
      cout<<s;
      }
      };
      int main()
      {
      Phone obj;
      obj.change();
      return 0;
      }

      Delete