C / C++ FAQ's and Practice problems

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2009
Posts: 2
Reputation: MagsG has a little shameless behaviour in the past 
Solved Threads: 0
MagsG MagsG is offline Offline
Newbie Poster

Re: C / C++ FAQ's and Practice problems

 
0
  #21
Oct 3rd, 2009
Originally Posted by John A View Post
Here is my contribution. Many of these problems occur frequently on the forums, but I thought these were worth saving and so I reproduced some of them here.
  • Write a program that allows you to input students' scores and weights. The program should then calculate a weighted average and score based on the data inputted by the user. (Beginner)
  • Make a program that allows the user to input either the radius, diameter, or area of the circle. The program should then calculate the other 2 based on the input. (Beginner)
  • Create a program that implements a database in C++. The fields are hard-coded, and the data is saved in a binary file. Although this isn't really flexibility, you aren't relying on any external libraries or functions. (Beginner)
  • Create a few classes that model playing cards. Then use this framework to create your favorite card game. (Intermediate)
  • Write a program that accepts XHTML, parses and removes the tags. Then it prints out the remaining text. (Intermediate)
  • Write a program which reverses the numerals in an integer, that is 326 becomes 623, etc.. (Intermediate)
  • Create a sophisticated linked list class. You should be able to insert and delete nodes anywhere in the list, and the nodes should have pointers to nodes both in front and behind them. (Intermediate)
  • Create a binary tree which has search and sorting functions. (Expert)
  • Create a Quine, that is, a program that prints out its own source code. (Expert)

MagsG>

create a program that will prompt the user to input an IP address
and a subnet mask. based on these inputs, your program must perform basic subnetting and calculate the IP address ranges for every subnet according to its class. [expert]
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 2
Reputation: gaya rathnayaka is an unknown quantity at this point 
Solved Threads: 0
gaya rathnayaka gaya rathnayaka is offline Offline
Newbie Poster
 
0
  #22
Oct 15th, 2009
Write a C program to calculate the distance between 2 points.
Hint:
■ Create a structure called point to define a point (x,y)
■ Get 2 points from the user
■ Distance,

d=(x2-x)+(y2-y1)
■ Define a function to calculate distance & give the answer in to 2 decimal places.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 2
Reputation: gaya rathnayaka is an unknown quantity at this point 
Solved Threads: 0
gaya rathnayaka gaya rathnayaka is offline Offline
Newbie Poster
 
0
  #23
Oct 15th, 2009
1. A palindrome is a phrase which would be the same when read beginning to end or end
to beginning.
Eg.
MADAM
ABBA
Write a C program to check whether a given phrase is a palindrome using the following
algorithm.
1. Initialize three stacks
2. Read a phrase from a file (Get file name from user), Note that each phrase is terminated
by a comma
3. For each letter in the phrase push it into the first and second stacks
4. Until the second stack become empty
pop an item from the second stack and push it into the third stack
5. Pop an item from first and third stack. Check whether they are equal
6. Repeat step 5 until both stacks (1 and 3) become empty. If all the items are same then
the phrase is a palindrome. Otherwise it is not a palindrome.
<Note>
Implement only the necessary functions to create the stack processing interface.
You can use given text files (f1.txt and f2.txt), where f1.txt contains a palindrome phrase and
f2.txt contains a non palindrome phrase.
Save your answer in your home directory (H:\) as XXXXXX.C, where XXXXXX represent your
registration number.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 1
Reputation: meenakshi dutt is an unknown quantity at this point 
Solved Threads: 0
meenakshi dutt meenakshi dutt is offline Offline
Newbie Poster
 
0
  #24
Oct 20th, 2009
Write a program to find the area of triangle
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 3,959
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 918
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite
 
2
  #25
31 Days Ago
Write a program that gives the weekday you were born.

Write a program that tells you many days old you are.

Write a program that lists the date of the third Wednesday of the month for the whole year.

Write a program that gives the difference in days between two given dates.

Dating is fun!

Just a note:
The DevCpp IDE and GNU compiler package is still available at:
http://sourceforge.net/projects/dev-cpp/files/
I installed (Windows XP):
devcpp-4.9.9.2_setup.exe
(about 8.9 MB download)
If you have Vista there are of course special considerations, see:
http://www.cs.okstate.edu/~katchou/d...irs/devcpp.htm

Also, if you use Linux, there is a version of DevCpp:
devcpp-bin_070.tar.gz
at the same site:
http://sourceforge.net/projects/dev-cpp/files/
Last edited by vegaseat; 31 Days Ago at 2:15 pm. Reason: C++ compiler package
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Reply

Tags
c++, faq, practice, problem, sticky

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC