Sponsored Links


Results 1 to 2 of 2

Thread: The number in two arrays after taking these number the array

  1. #1
    sana.pari
    Guest

    Cool The number in two arrays after taking these number the array

    Sponsored Links1


    RESPECTED SIR I HAD CODED THIS PROGRAM WHICH TAKES AND SAVE THE NUMBER IN

    Sponsored Links

    TWO ARRAYS AFTER TAKING THESE NUMBER THE ARRAY COMPARE THESE AI THESE ARE EQUAL

    THEN THE MESSAGE SHOULD BE THAT ARRAY ARE EQUAL OTHERWISE THESE ARRAYS ARE

    NOT EQUAL. I HAD CODED THIS BUT IT DOE SNOT WORK FINE KINDLY SENT ME THE

    CORRECT CODE

    #include<iostream.h>
    #include<conio.h>
    main()
    {
    int num1[5];
    int num2[5];
    int i;
    int equals=0;
    cout<<"PLEASE ENTER THE NUMBER";
    for (i=0;i<5;i++)
    {
    cin>>num1[i];
    }
    for (i=0;i<5;i++)
    {
    cout<<num1[i];
    }
    cout<<endl;
    cout<<"PLEASE ENTER TRHE NUMBER";
    for (i=0;i<5;i++)
    {
    cin>>num2[i];
    }
    for (i=0;i<5;i++)
    {
    cout<<num2[i];
    }
    cout<<getch();
    for (i=0;i<5;i++)
    {
    if (num1[i]!=num2[i])
    equals==0;
    break;
    }
    cout<<endl;
    if (equals==0)
    {
    cout<<"THE ARRAYS ARE NOT EQUAL";
    }
    for (i=0;i<5;i++)
    {
    if (num1[i]==num2[i])
    equals==1;
    break;
    }
    cout<<endl;
    if (equals==1)
    {
    cout<<"THE ARRAYS ARE EQUAL ";
    }

    cout<<getch();
    }

  2. #2
    Dear Student,
    Below is the modified code for array comparison.

    #include<iostream.h>
    #include<conio.h>
    main()
    {
    int num1[5];
    int num2[5];
    int i;
    int equals=0;

    cout<<"PLEASE ENTER THE NUMBER"<<endl;

    for (i=0;i<5;i++)
    {

    cin>>num1[i];

    }


    for (i=0;i<5;i++)
    {

    cout<<num1[i];

    }

    cout<<endl;

    cout<<"PLEASE ENTER THE NUMBER"<<endl;

    for (i=0;i<5;i++)
    {
    cin>>num2[i];
    }

    for (i=0;i<5;i++)
    {
    cout<<num2[i];
    }

    for ( i = 0 ; i < 5 ; i ++ )
    {
    if ( num1 [ i ] != num2 [ i ] )
    {

    cout << "\n The arrays are not equal " ;
    equals = 0 ;
    break ;
    }
    equals = 1;
    }

    if (equals)
    cout << "\n Both arrays are equal" ;

    system("pause");
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to Check Warid Your Number Ownership
    By Entboy in forum Warid
    Replies: 0
    Last Post: 09-17-2014, 06:26 PM
  2. Replies: 0
    Last Post: 07-20-2011, 07:33 PM
  3. Rational Number Calculator
    By Cs151 in forum Get Solution In 24 Hour
    Replies: 2
    Last Post: 05-08-2011, 06:03 AM
  4. You Can Have Following Details Of a Telenor Number
    By Xpert in forum wireless services
    Replies: 0
    Last Post: 12-12-2010, 01:35 AM
  5. share assignment number plz
    By sanam in forum General Discussion About Study
    Replies: 3
    Last Post: 10-22-2010, 05:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft