₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,331,147 members, 8,448,863 topics. Date: Monday, 20 July 2026 at 11:42 PM

Toggle theme

Please Can Someone Me With This Question On C++ - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingPlease Can Someone Me With This Question On C++ (798 Views)

1 Reply (Go Down)

Please Can Someone Me With This Question On C++ by ade4prof(op): 10:22pm On Jun 14, 2021
Write a C++ program that print "Too Many" when the variable count exceeds 100
Re: Please Can Someone Me With This Question On C++ by stanliwise(m): 7:25am On Jun 15, 2021
ade4prof:
Write a C++ program that print "Too Many" when the variable count exceeds 100
Use a simple loop.
Check google it is everywhere.
Re: Please Can Someone Me With This Question On C++ by Nobody: 9:08am On Jun 19, 2021
It is been long I did c++ though, but I think this code should work, with maybe a little debugging

#include<iostream>
using namespace std;
int main(){

for(int count = 1; count<=101; count++){
cout<<count<<endl;
if(count>100){
cout<<"Too many"<<endl;
}

return 0;
}
Re: Please Can Someone Me With This Question On C++ by Deicide: 6:03pm On Jun 19, 2021

int count = 0;
do{
count<<"Too many";
break;
}while(count++ > 100);
Re: Please Can Someone Me With This Question On C++ by ehinorlive: 6:53pm On Jun 19, 2021
Ikesmith:
It is been long I did c++ though, but I think this code should work, with maybe a little debugging

#include<iostream>
using namespace std;
int main(){

for(int count = 1; count<=101; count++){
cout<<count<<endl;
if(count>100){
cout<<"Too many"<<endl;
}

return 0;
}
change for(int count = 1; count<=101; count++){

to for(int count = 1; count<101; count++){
Re: Please Can Someone Me With This Question On C++ by shegzhkn: 9:16pm On Jun 19, 2021
Deicide:

int count = 0;
do{
count<<"Too many";
break;
}while(count++ > 100);
Really ??

Flawed code .
Re: Please Can Someone Me With This Question On C++ by africonn: 10:31pm On Jun 19, 2021
shegzhkn:
Really ??

Flawed code .
< Will fix the bug
Re: Please Can Someone Me With This Question On C++ by Deicide: 11:20pm On Jun 19, 2021
shegzhkn:
Really ??

Flawed code .
How is it flawed?
africonn:
< Will fix the bug
Which bug?
Re: Please Can Someone Me With This Question On C++ by TheCongo2: 11:41pm On Jun 19, 2021
ehinorlive:
change for(int count = 1; count<=101; count++){

to for(int count = 1; count<101; count++){
What is wrong with count <= 101
Re: Please Can Someone Me With This Question On C++ by ehinorlive: 10:11am On Jun 20, 2021
TheCongo2:
What is wrong with count <= 101
using ( < = ) will make it count to exactly 101 but using (< ) will count to 100
Re: Please Can Someone Me With This Question On C++ by TheCongo2: 7:04pm On Jun 20, 2021
ehinorlive:
using ( < = ) will make it count to exactly 101 but using (< ) will count to 100
Thank you so much
Re: Please Can Someone Me With This Question On C++ by airsaylongcome: 10:07pm On Jun 20, 2021
Deicide:

int count = 0;
do{
count<<"Too many";
break;
}while(count++ > 100);
Do loop will execute at least once before checking the loop condition meaning it will print "Too many" 100 times and when count=101 will stop and print nothing
Re: Please Can Someone Me With This Question On C++ by Deicide: 1:31am On Jun 21, 2021
airsaylongcome:
Do loop will execute at least once before checking the loop condition meaning it will print "Too many" 100 times and when count=101 will stop and print nothing
did you run my code and it prints "Too many" 100 times?
1 Reply

Help Needed On CTutor On C# NeededHelp Needed On C#234

Course Creators NeededPython Programmers! Can The Errors Of Pycodestyle be Automated ?If You Are Learning To Code Avoid Nairaland Frontpages