Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8965767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:52:55+00:00 2026-06-15T16:52:55+00:00

here is my code which needs to make a check about a student by

  • 0

here is my code which needs to make a check about a student by his faculty number, and if there is no information to say that …

cout<<"Enter faculty number of the student(8 digits): "<<endl;
cin>>ch;
cout<<"Information about student with number:"<<ch<<endl;
    for(i=0;i<n;i++)
    {
        if(m[i][0]==ch)
        {
            for(j=0;j<4;j++)
                cout<<setprecision(8)<<m[i][j]<<"\t";
        }
        else if(m[i][0]!=ch)
        {
            cout<<"No information about this student"<<endl;
        }
    }

it works mostly fine, the problem is that if my “n”(number of student typed out of this code) is 3 … we will have 3 student and the cycle “for” will be made 3 times .. and we type 1 student (actually we are typing 1 faculty number) when i start the program it says whole information about that student and on two new lines it says “No information about this student”.
I cant put the IF check out of that FOR with N because i need to roll the m[i]… thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:52:57+00:00Added an answer on June 15, 2026 at 4:52 pm

    I have a few suggestions for this code.

    1) Checking m[i][0] == ch after locating the entry only makes sense if a student is expected to have multiple entries. I suspect not, in which case you should make the loop break as soon as m[i][0] == ch.

    2) cout<<"No information about this student"<<endl; shouldn’t be in the loop because it will print n - 1 times (if ch is indeed a valid ID, n times otherwise). Make the related check afterwards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help with a weird runtime error. Here's the code which gives it:
Here is the code which test in IE8: var stack = []; function test()
Here is jquery code which hides my table cells with the ID of .style2:
Here is my code which checks if the file exists : #include<stdio.h> #include<zlib.h> #include<unistd.h>
Here is my code which is doing the conversion from hex to decimal. The
I have some code here which works perfectly in firefox but not in chrome
I have this piece of Open MP code here which performs an integeration of
i have this quick issue please. I have this code here which permits me
I'm just trying out the allegro library, and here is the code which I've
I want to create a dynamic Expression<Func<T,Y>> . Here is the code which works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.