| | |
C / C++ FAQ's and Practice problems
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2009
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
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]
•
•
Join Date: Oct 2009
Posts: 2
Reputation:
Solved Threads: 0
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.
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.
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/
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!
![]() |
Similar Threads
- Factorial of a number (C)
- Practice Programs (Java)
Other Threads in the C++ Forum
- Previous Thread: how to program a program to calculate the area and the perimetre of a circle?
- Next Thread: Help with my code/string compare
| Thread Tools | Search this Thread |
.dll api array arrays assignment background beginner bitmap borland box bug bugs c++ char char* class client code codeblocks codebox commentinghelp compression console consumer cpu crash css database decide delayload delete desktop development directshow display download ebook eclipse encryption equation error exam examples faq file findcontrol fpx freeze fstream function functions game graph gui insert int introduction java jni linker lnk2019 loop math method modal multiple newbie numbers output parallel pong primenumbersinrange print problem program programming projects python qt read recursion recursive registry snakes stop string struct subdomain superclass symbian temperature template text threads tutorial url variable visual win32 wxwidgets







