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

  • SEARCH
  • Home
  • 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 8943113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:41:39+00:00 2026-06-15T11:41:39+00:00

I want to do only the one thing in that cycle … – the

  • 0

I want to do only the one thing in that cycle … – the IF or the ELSE .. (when its true and false ofc as you know it ..) If i have two typed students with their information and my first student in group 1 is not with an excellent grade and the second one student is with excellent grade my program prints:
1)first loop on for:it;s false so it makes the else
2)second loop on for: it’s true so it makes the if

and i have:
No information
Student with excellent grade…

I want to see only the students with excellent grade (if i use BREAK; i will stop the FOR cycle) Here is my code:

int gr;
cout<<"Enter group that you want to check: ";cin>>gr;
cout<<"Students with excellent grade in group "<<gr<<":\n";
    for(i=0;i<n;i++)
        {
            if(m[i][2]==gr && m[i][3]>=5.500)
            {
                for(j=0;j<4;j++)
                    cout<<setprecision(8)<<m[i][j]<<"\t";
            }
            else
                    cout<<"No students with excellent grade in this group"<<endl;

        }

I have the same problem here. Can i use the “bool” type and how in that code(code is based on struct):

int x;
bool no_info=false;
p: cout<<"| What personal id you want to search for: ";cin>>x;

for(int i=0;i<n;i++)
{
  if(pov[i].id==x)
  {
    no_info=true;
    cout<<pov[i].id<<endl;
    cout<<pov[i].name<<endl;
    cout<<pov[i].lastname<<endl;
    cout<<pov[i].department<<endl;
    cout<<pov[i].salary<<endl;
  }
}
  if(no_info){
   cout<<"No information"<<endl;}
 goto p;

EDITED!!!

  • 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-15T11:41:40+00:00Added an answer on June 15, 2026 at 11:41 am

    It is hard to understand what you are trying to achieve. But I think what you want is:

    int gr;
    bool no_excellents = true;
    cout<<"Enter group that you want to check: ";cin>>gr;
    cout<<"Students with excellent grade in group "<<gr<<":\n";
    for(i=0;i<n;i++)
    {
        if(m[i][2]==gr && m[i][3]>=5.500)
        {
           no_excellents = false;
           for(j=0;j<4;j++)
               cout<<setprecision(8)<<m[i][j]<<"\t";
        }
    }
    
    if(no_excellents)
    {
        cout<<"No students with excellent grade in this group"<<endl;
    }
    

    This will not stop your for loop, and will only print those students who have excellent grades. If nobody has excellent grades, the program will tell you so.

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

Sidebar

Related Questions

i have a page that contains several submit buttons however i only want one
Basically, I want to have an app with only one view that has an
If I have Model.objects.all() I want to get only one object for any content_object=foo,
I have a several processes node.js. I want to only add one string to
I have two sites with different SITE_IDs, but I want to have only one
I have a two UIViews filled with UIButtons. I want to only allow one
Just need to confirm one thing that i have searched enough on How can
I want to show only one thing in one page.I change select page size
We only want one instance of our app running at any one time. So
I want to select only one radio button but I cant do this. Here

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.