Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,208,833 members, 8,003,961 topics. Date: Saturday, 16 November 2024 at 02:19 AM |
Nairaland Forum / Science/Technology / Programming / Please Can Someone Me With This Question On C++ (627 Views)
Help Needed On C / Tutor On C# Needed / Help Needed On C# (2) (3) (4)
Please Can Someone Me With This Question On C++ by ade4prof: 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: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 |
|
Re: Please Can Someone Me With This Question On C++ by ehinorlive: 6:53pm On Jun 19, 2021 |
Ikesmith: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 |
Re: Please Can Someone Me With This Question On C++ by africonn: 10:31pm On Jun 19, 2021 |
shegzhkn: < Will fix the bug |
Re: Please Can Someone Me With This Question On C++ by Deicide: 11:20pm On Jun 19, 2021 |
Re: Please Can Someone Me With This Question On C++ by TheCongo2: 11:41pm On Jun 19, 2021 |
ehinorlive: 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: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: Thank you so much |
Re: Please Can Someone Me With This Question On C++ by airsaylongcome: 10:07pm On Jun 20, 2021 |
Deicide: 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:did you run my code and it prints "Too many" 100 times? |
(1) (Reply)
Who's Good With Logical Word Problems (pay) / Senior Android App Developer Needed (300-400k) / I Made Some Chrome Extensions
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12 |