Here's what I have to do: Using strcpy() pass it two strings of characters (such as a name like John Johnson) and copy the second string into the first, in reverse order, and print both. Write a main to exercise your function and to illustrate that the function is working properly.
I have to write a c program that will allow the user to enter names with ages. The name will be no longer than 40 characters. The name and age should be stored in a node of a doubly linked list. I cant use global data. I need to use 3 subroutines. the first one needs to enter the data and pass the head and tail pointers to the subroutine. the next subroutine needs to print the names and ages to the screen and file output.txt from first to last. the last subroutine needs to print out names and ages to the screen and file output.txt from the last to first.
Im getting several errors when i try to run this program. The first subroutine to get the data from the user and build the double linked list. but i seem to be having issues.
#include <stdio.h> #include <stdio.h> #include <ctype.h> #include <string.h> int entry(char [][41], int []); // subroutine used for data entry // void printit(char [][41], int [], int); // subroutine used for data printing // void reverseprintit(char [][41], int [], int); // subroutine used for reverse data printing //
1. Construct a class diagram that can be used to represent food items. A type of food can be classified as basic or prepared. Basic food items can be further classified as meat, fruit, veg or Grain. The services provide by the class should be the ability to enter data for new food, to change data for food and to display existing data about food.
using this class definition write a main program to include a simple menu that offers the following choices:
1. Add food 2. Modify Food 3. Delete Food 4. Exit this menu
2. Read a list of numbers from a file and then print them out in reverse order. State whether the list is palindromic or not.
Implement a recursive function named void printBack(DoublyLinkedNode<T>* node) for the class DoublyLinkedCircularList which will print out the elements in the list from back to front. The function is initially called with the first node in the list. You may not make use of the previous(prev) links
This is my solution where I got 2 out of a possible 3 marks:
template<class T> void DoublyLinkedCircularList<T> :: printBack(DoublyLinkedNode<T>* node) { if(node->next == NULL) //Correct- 1 mark return 0; else printBack(node->next); //Correct - 1 mark cout << current-> element << " "; }
I made a simple little program that takes text from the clipboard, and spits out all the lines I've copied one at a time (so my program can analyze it).
everything works perfectly, except, it spits it own in the wrong order, I want it to spit out from bottom to top. but currently it spits out the data from top to bottom. here is my code :
Code: #include <iostream> #include <Windows.h> #include <string> #include <sstream> using namespace std; int main() { HANDLE clip; // assigns the var. clip to hold a handle ID.
[Code] .....
I want this loop to run backwards! Like it say's what I want to work backwards. Where as I know how to flip a while loop like this: while(x < 5), how to flip a loop like the one I'm using. how I can do this?
Using the array to accept 10 testscore. Calculate and print the highest, lowest, fifth test score entered and all the test score entered in reverse order.
How i would get it to print the highest,and lowest and in reverse order. I'm confused as to what to do...
Very new to programming, and I know that there must be another way on inputting a string into each array cells not by just inputting it one by one, but as a whole. My code at the meantime is: [URL]
I was browsing the web looking for simple yet fun programming challenges and crossed this one. I figured out how to reverse the string in place but I want it to read "blue is house the". I approached it in two ways for the heck of it. My idea was the second one, the first one I googled. I didn't know a simple rbegin() could do that, pretty neat.
I found the question here.[URL] ....
Code: #include <iostream> #include <string> int main(int argc, const char * argv[]) { std::string phrase = "The house is blue.";
How do reverse every alternate words in a string that I read into my program:
e.g. The mouse was caught in a clothes peg. reversed (including the full stop) The esoum was thguac in a clothes gep.
I could program it to reverse the whole sentence. But no clue how to reverse certain words such as every even word. Do I need a function and/or loop to solve this?
#include<iostream> // allow input and output #include<string> // allow for larger entries of characters using namespace std; int main() { string sentence, reversed_sentence;
How to print a string in reverse order(for example: "today is Wednesday " to "Wednesday is today"). My professor said we should begin with a null string and build it one word at a time.
#include <iostream> #include <fstream> #include <string> using namespace std; int nwords(string);
I am supposed to take the three string lines from a text file and then individually reverse them and state whether or not they are a palindrome. I have the three lines from the text file into string variables already but I am not sure on how to reverse them and then see if they are the same reversed(palindrome)
I have declared a constant integer arraysize in line 35. Now I have no clue why is this happening because I think as I have declared it as a constant integer variable, this should not happen.
void reverse(char *in, int isize) { char t = 0; for( int a = 0; a < isize / 2; a++ ) { t = in[a]; in[a] = in[(isize - 1) - a]; in[(isize - 1) - a] = t; [Code] .....
s: float:123456 s:123456
The function i made is working fine, exacly how cout << float is working. The problem is i think my function is not really effective. By that i mean my function is doing alot of useless stuff to do what i want and there have to be a better way.
The rule is that you can not use other functions, only playing with loops and operators.