Results 1 to 4 of 4

Thread: For C++ experts only..............

  1. #1
    MindHunter's Avatar
    MindHunter is offline Advance Member
    Last Online
    2nd February 2021 @ 02:52 PM
    Join Date
    09 Jun 2007
    Gender
    Male
    Posts
    767
    Threads
    78
    Credits
    200
    Thanked
    39

    Question For C++ experts only..............

    hi programmers i hope everyone is doing fine..... mujay ek problem ka solution chahya... ma na kafi koshesh ki ha lakin ma solve nhi ker paya........ masla yeh hai k c++ ma char variable ki values ko compare kerna hai............. ma na kafi koshes ki hai lakin dono value same enter kernay k bawjood output ma result kuch aur hota hai.......... suppose ma na variable a ki value rakhi PAK. ab same value variable b ko allot ki jub dono values ko compare kya to c++ k mutabik dono ki values different ati hain................. do any one have solution.............. help me please.
    External Site Link Not Allowed In Signature(ALi.HaiDEr)

  2. #2
    imranpk's Avatar
    imranpk is offline Senior Member+
    Last Online
    31st October 2023 @ 08:34 AM
    Join Date
    21 Jan 2006
    Location
    Lahore
    Gender
    Male
    Posts
    349
    Threads
    44
    Credits
    17
    Thanked
    33

    Default

    sir example share krni thi code ki may b code mai masla ho anyhow ye example check karain c++ ki

    #include <iostream>
    #include <string>
    using namespace std;

    int main() {
    string word="php";
    string word1="php";

    if(word==word1){
    cout<<"word = word1"<<endl;
    }

    return 0;
    }


  3. #3
    sayhellotoit's Avatar
    sayhellotoit is offline Senior Member
    Last Online
    23rd September 2017 @ 07:51 PM
    Join Date
    01 May 2009
    Posts
    1,003
    Threads
    5
    Credits
    53
    Thanked
    127

    Default

    Char variable kay ander aap sirf aik character store ker saktay hain. Jaisay PAK ka sirf P store ho ga.
    Aap ko character pointer type kay variable mein store karna paray ga.
    #include <iostream>
    using namespace std;

    int main() {
    char *a = "PAK";
    char *b = "PAK";

    if(a == b)
    { cout<<"Equal"<<endl; }
    else
    {cout<<"Different"<<endl; }

    system("PAUSE");
    return 0;
    }
    Character pointer ki jaga string bhi istamal ki ja sakti hay, jaisa keh imranpk nay btaya hay.

  4. #4
    MindHunter's Avatar
    MindHunter is offline Advance Member
    Last Online
    2nd February 2021 @ 02:52 PM
    Join Date
    09 Jun 2007
    Gender
    Male
    Posts
    767
    Threads
    78
    Credits
    200
    Thanked
    39

    Default

    thanx guys........ let me try both........

Similar Threads

  1. Solved Experts can you tell me plz?
    By Aqeel jutt in forum Solved Problems (IT)
    Replies: 4
    Last Post: 9th September 2012, 10:35 PM
  2. Solved Experts Experts Experts HELP
    By sarfraz141991 in forum Solved Problems (IT)
    Replies: 6
    Last Post: 22nd June 2012, 07:23 AM
  3. Experts please help
    By sheikhaamir in forum Ask an Expert
    Replies: 9
    Last Post: 1st May 2012, 10:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •