473,395 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Got a C++ programming competition at university. Need a list of programs to practice.

4
Hey everyone, as the titles says it all. I've got a C++ programming competition at university only for the students of 1st semester. We just started problem solving and C++ coding in this semester. Up till now we have studied
All control Structures and basics of programming. We haven't studied arrays and custom functions till now. If you can give me a list of programs which doesn't use custom functions and arrays, it would be great. I want to practice as much as I can. Thanks for your kind help.
May 16 '14 #1
3 1316
weaknessforcats
9,208 Expert Mod 8TB
1)calculate the number of days between 1/1/2000 and 5/16/2014.

2)user enters an integer number of pennies. Displays this number in dollars and cents without using floating point. 46 becomes $0.46. 1234 becomes $12.34
May 16 '14 #2
aimi95
4
Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. void main()
  5. {
  6.  
  7. int penny,a,b;
  8.  
  9. cout<< "Enter ammount in pennies: ";
  10. cin>>penny;
  11.  
  12. if(penny>0 && penny<100)
  13. {
  14.     a = penny / 10;
  15.     b = penny % 10;
  16.  
  17.     cout<<endl<<"$ 0." <<a <<b;
  18. }
  19.  
  20. else if(penny>=100 && penny<1000)
  21. {
  22.     int c,d;
  23.  
  24.     a = penny / 100;
  25.     b = penny % 100;
  26.     c = b / 10;
  27.     d = b % 10;
  28.  
  29.     cout<<endl<<endl<< "$" <<a<< "." <<c<<d;
  30.  
  31. }
  32.  
  33. else
  34. cout<<endl<<endl <<"Invalid range";
  35.  
  36. }
  37.  
May 18 '14 #3
stdq
94 64KB
Try this one too: write a recursive function that receives a positive value in base 10 and prints its binary equivalent.
May 18 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: vishnu mahendra | last post by:
Hello to all, I need some suggestions for programs for our java lab cycle. The topics are as follows OOPS MULTITHREADING FILE IO PACKAGES INTERFACES
0
by: integer | last post by:
http://dinsights.com/POTM/KEYSTROKES/details.php
0
by: richard | last post by:
The 48-Hour Game Programming Competition is a "mostly from scratch", timed, solo coding challenge where all willing game developers spend their allowed time making the best game they can under a...
4
by: Crystal | last post by:
Ok, I know this sounds weird, but it's really bugging me. I have a few list boxes on my form (basic pick a month, year, state stuff) and you can only choose one value. I need to be able to run a...
2
by: Laurence | last post by:
So I had an 1D10T moment today: ran ngen /delete * and then compounded my error by closing the window. Of course now my window code starts far slower, but I don't want to blindly precompile...
0
by: mouser | last post by:
Greetings All, We've just posted the results of a C++ (Builder) programming contest I announced here a while ago: http://bcbcontest.donationcoder.com NOTE: comp.lang.c++ is mostly focused...
0
by: Romram | last post by:
BITWISE is an annual online programming contest. The contest is organized by the Computer Science and Engineering Department Society of IIT Kharagpur, on the second Sunday of February every year....
17
Banfa
by: Banfa | last post by:
I felt that this was a good point to start a tutorial on C/C++ programming because clearly we need to have some idea of what we are trying to achieve before we start out. I recently found this...
5
RobH
by: RobH | last post by:
I have a report that has some Listboxes - due to the nature that these can do SQL Queries within themselves but they appear with boxes around them and the content does not wrap. How Can I make a...
1
by: Mark Stevens | last post by:
Hello. I need a list box which will display the contents of a folder with a specific files type in it. For instance, if the folder contains .exe, .txt and .zip files I need it to just display the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.