Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
SUPER URGENT C++ help please!!!?
Please help me with the following questions.....
1) Each node of a STACK contains the following information, in addition to required pointer field :
(i) Pincode of a city (ii) Name of city
Give the structure of node for the linked stack in question.
TOP is a pointer points to the topmost node of the STACK. Write the following functions:
(i) PUSH() - To push a node in to the stack which is allocated dynamically.
(ii) POP() - To remove a node from the stack and release the memory.
2) Write an algorithm/program to search for 66 and 71 in the following array:
3,4,7,11,18,29,45,71,87,89,93,96,99
Make use of binary search technique . Also give the intermediate results while executing this algorithm. Convert this algorithm into a C++ program.
3) Assuming that a text file named TEXT1.TXT already contains some text written to it, write a function named vowelwords(), that reads the file TEXT1.TXT and creates a new file named TEXT2.TXT, which shall contain only those words from the file TEXT1.TXT which don't start with an uppercase vowel (i.e, with 'A','E','I','O','U'). For example, if the file TEXT1.TXT contains
Carry Umbrella and Overcoat When it Rains
then the file TEXT2.TXT shall contain
Carry When it Rains
Please solve these (or any of them) as soon as possible as i need it really very urgently! PLEASE!
edit: I had a 8 questions to do, & i solved 5 of them and only these 3 were the one i had problem in.
4 Answers
- CubbiLv 71 decade agoFavorite Answer
1) question is poorly worded, what is that "required pointer field" and where does "TOP" come in?
2) The algorithm should have been explained, but if you have to spell it out, you can look it up on wikipedia for example : http://en.wikipedia.org/wiki/Binary_search_algorit...
When translated to C++, the algorithm collapses in a single call to binary_search()
#include <iostream>
#include <algorithm>
int main()
{
int a[] = {3, 4, 7, 11, 18, 29, 45, 71, 87, 89, 93, 96, 99};
int N = sizeof(a) / sizeof(a[0]);
bool found = std::binary_search(a, a+N, 66);
if(found) std::cout << "66 found in the array\n";
else std::cout << "66 not found in the array\n";
found = std::binary_search(a, a+N, 71);
if(found) std::cout << "71 found in the array\n";
else std::cout << "71 not found in the array\n";
}
3) You can represent TEXT1.TXT as a pair of string input iterators and remove_copy_if() from it to TEXT2.TXT
#include <iostream>
#include <algorithm>
#include <fstream>
#include <string>
#include <iterator>
bool StartsWithVowel(const std::string& s)
{
return std::string("AEIOU").find( s.at(0) ) != std::string::npos;
}
int main()
{
std::ifstream fin("TEXT1.TXT");
std::ofstream fout("TEXT2.TXT");
remove_copy_if( std::istream_iterator<std::string>(fin),
std::istream_iterator<std::string>(),
std::ostream_iterator<std::string>(fout, " "),
StartsWithVowel);
}
- cosimoLv 51 decade ago
Dear T-REX
These are obviously assignment/homework tasks. You may have not understood this, but the point is that YOU do the work yourself. People don't randomly get set these tasks, they tend to be assigned as part of a course where you have already covered enough information to get you started. Assuming that's the case, try to do the work yourself and come back to us when you get stuck.
Hopefully everyone else who looks at this will agree with me that it is not beneficial to anyone, nor is it fair or ethical for us to do your homework for you, but it would be beneficial if we can help to advise you when you get it wrong.
So, go ahead. Try to do the work yourself and come back if you have specific problems.
Additional Details:
It doesn't really matter how many questions you had to do or how many you managed on your own. If you're only capable of managing 5 on your own without even appearing to attempt the other 3 then that's the work you should be handing in to your tutor. If you got 5/8 absolutely right then that's 62.5% and is, presumably a pass. Would you really be happy about getting 100% by abusing the efforts of people on here and presenting the work as your own? Coursework like this is intended to find out how much YOU understand, not how much WE understand. As I mentioned earlier though, if you can show us how much you have done of these questions then it may be that we can help you to understand how to get the solution when you get stuck. That is beneficial to you, in my opinion just giving you answers benefits no one.
- Anonymous4 years ago
Its Db considerable! in case you look on the considerable signature you in many circumstances look on the 2nd to final flat and that can help comprehend what key it is in. occasion: in case you have 3 residences you look on the 2nd to final one that skill it may be Eb in case you have 6 residences the 2nd to final flat could be Gb! Make experience? :)