Visual C++ :: Backward Function - Reversing Words Entered?

Apr 21, 2013

My program , it says there is no problem with the build but when exe. it displays a bunch of backward 'k' instead of reversing the words entered.

Problem: Enter in a C-string and use function to display the word backward. (it might work with a pointer but I am not sure how to go about it)

lab10_p2.cpp

View 4 Replies


ADVERTISEMENT

C :: Reversing String Not Words

Oct 2, 2014

I am trying to write a program in C to reverse a string .

Example - This is America
output - America is This

I have thought of two ways of doing this question

1) using 2D arrays ( no pointer)
2) Using Strings and pointer

Code:
#include<stdio.h>
#include<string.h>
main()
}

[code]....

View 4 Replies View Related

C++ :: How To Recognize Two Words Entered By User For A String

Feb 11, 2013

In my little experiment i am trying to get the compiler to recognize 1 word with 2 parts from a list of names.

For example: if the user wanted to choose "candy bar", from a list of items which include: "candy bar", "cat", "dog"

My current code can recognize words without a space like cat and dog. But how can i recognize candy bar?

I tried using getline but its of no use.

View 2 Replies View Related

Visual C++ :: How To Move Video Forward / Backward When User Drags Slider Bar

Jun 11, 2013

I am working on a project in which I use DirectShow to Play / Pause / Stop the video. I am using slider bar to show the progress of the video. As the video starts playing, the slider bar moves in proportion to the video duration. Now when user moves/drags the slider bar to a new position, I want to forward the video in equivalent proportion.

Say if video duration is 50 seconds and max range of the slider bar is set to 100. slider will 2 steps for 1 second of video progress. Now if user drags the slider to 60 while video is playing, I want to increment/forward the video. if user moves the slider backward, video should move backward.

I have done with the slider moving along with the video and when user drags the slider. How to set the new position of the video, so that the video starts playing from that point.

View 4 Replies View Related

C++ :: Char Array Reversing Function Using Pointer?

Feb 4, 2014

Why does this code doesnt work?

#include <iostream>
#include <cstring>
#include <string>
using namespace std;
class my_string {
char* ptr;

[code] ....

View 1 Replies View Related

C++ :: Count Backward From 100 To 1 In Increments Of 10

Nov 5, 2014

The question is Create a counting program that counts backward from 100 to 1 in increments of 10.

#include <iostream>
using namespace std;
int main() {
int num = 1;
while (num<100) {

[Code] ....

It seems there are some errors.

View 1 Replies View Related

C++ :: Fill Array Of Size 16 A-P Forward And Backward

Apr 28, 2014

I am trying to fill an array of size 16 A-P forward and backward but im having a hard time filling the array with A-P. Here's what i have so far.

#include<iostream>
#include<iomanip>
using namespace std;
int main() {
int arr[16];
char mych='A';

[Code] ....

View 1 Replies View Related

Visual C++ :: Using Loop To Take User Input And Keep Running Sum Until 0 Entered

Feb 28, 2013

I am stuck on an exercise where i am supposed to use a loop to take user input and keep a running sum until the user enters a 0. the code i have so far is:

#include <iostream>
int main() {
using namespace std;
int num;
int total = 0;
int x;

[Code] ....

The full text of the error message is: error c2678:binary'>>':no operator found which takes a left-hand operand of type 'std::istream' . and one more thing i was wondering, is there a difference between c++ and visual c++?

View 4 Replies View Related

Visual C++ :: Generate Class Average For Entered Test Scores

Jan 14, 2013

Below is the program I have written yet I can't seem to get it to work right.

// Purpose: generate a class average for entered test scores
// Input: # of tests, test scores
// Output: total number of tests, average score of tests

#include <iostream>
#include <iomanip>
using namespace std;
int main() {
//declare variables
short numberOfTests = 0;

[Code] .....

View 6 Replies View Related

C :: Output Smallest Integer Entered - Loops / Function

Oct 22, 2014

I am trying to find a way to put a getSmallest function in here so that it will output smallest integer entered. If it is just an arbitrary amount of #'s and I don't know what will be entered I am confused. Both on how to do it and how to link my function to my loop.

Code:
/* Prompts user and gets integer numbers from keyboard, one number at a time. Ends program when 99999 entered. and displays various results.
Written by:
Date: 10/20/14
*/
#include <stdio.h>
#include <stdlib.h>

[Code] .....

Could I take this and just replace all variables a, b, and c with getNumber, where would I link/declare smallest?

Code:
/* ==================== smallest ======================
This function returns the smallest of 3 integers.
Pre given 3 integers
Post the smallest integer returned
*/
int smallest (int a, int b, int c) {

[Code] ......

View 1 Replies View Related

C :: Compute Permutations Of Any String Entered - Function Will Not Return A Value

Jun 11, 2013

This is my program, for now it is intended to compute permutations of any string entered, but the function ox will not return the final x value. ox is the function that actually computes the permutations so the return of the x value is critical.

Code:
#include<stdio.h>
#include<string.h>
int ox(int x);
int main() {
int x;
char input[10];

[Code] .....

View 2 Replies View Related

C++ :: Function To Count Digits Of Entered Number Doesn't Work

Feb 19, 2013

I wrote a program with function my own function which count the digits of entered number. The problem is whatever i type it shows 0 digits.Why is that?

Code:
#include <iostream>
using namespace std;
int cikCipari (int skaitlis, int cipars);
int main()

[Code] .....

View 7 Replies View Related

C++ :: Function That Makes Shows Time Entered In Clock Format

Mar 11, 2014

Program should continually have user enter a positive integer, and quits on zero entered. This entered number represents the total number of seconds and after each number is entered a function is called that displays the time in hours, minutes and seconds. Sample output is as follows:

Enter Total Seconds --> 3605 1:00:05

The function needs only one value parameter and should return nothing back to main. If the minutes or seconds are a one digit number then make sure to display a leading zero as the example above shows.

Here is my program. my question is how do i make the numbers appear like this? 1:00:05

#include <iostream>
#include <iomanip>
using namespace std;

[Code].....

View 6 Replies View Related

Visual C++ :: Parsing A Line For Words?

Sep 21, 2013

I'm getting this when I compile my program. Then, when the program runs I get an error. I assume it is because I have the warning for this problem. How can get around this error.

warning C4172: returning address of local variable or temporary

Code:

#include <iostream>
#include <cstring>
using namespace std;

[Code]....

View 10 Replies View Related

Visual C++ :: Vector Input / Counting Words

Feb 3, 2014

I am trying to write a program that counts specific words that a user inputs "Howdy/howdy/Whoop/whoop" (yes I go to Texas A&M, hence those specific words) I am having an issue where it wont count the first word even if it is "Howdy"

For example if I put it:

"Howdy howdy whoop Whoop" - it only outputs that it counted 3 words

now if I were to do:

"Hello Howdy howdy whoop Whoop" - it would count 4.

Code:

#include "std_lib_facilities_4.h"
int main(){
cout << "Please enter desired words, when you have entered all words, please type CTRL+d (EOF Command)
" << endl;
//It was assumed that EOF command was going to be used here hence the necessity of 'CTRL+d'
vector<string>words;

[Code] ...

View 2 Replies View Related

C/C++ :: Print Single Linked List Backward With Functions / Classes - Error Message Regarding Header Files

Oct 11, 2014

I'm trying to print a single linked list backward with functions/classes. I have created the main file and 3 header files. But I'm getting an error on one of the header files, linkedListIterator after adding #include "linkedListType.h". It says that "linkedLlistType.h" is calling itself. And when I try to run it, I get an error of "too many header files." I have tried changing the headers many times, but nothing seems to work.

.cpp file:

/*(Printing a single linked list backward) Include the functions reversePrint and recursiveReversePrint, as discussed in this chapter, in the class linkedListType. Also, write a program function to print a (single) linked list backward. (Use either the class unorderedLinkedList or the class orderedLinkedList to test your function.)*/

#include "linkedListType.h"
#include "orderedLinkedList.h"
#include "linkedListIterator.h"
#include <iostream>
using namespace std;
struct nodeType

[Code] ....

header files:
[URL] .... (error in this header file)
[URL] ....

View 9 Replies View Related

C++ :: Count Number Of Words And Lines Then Print All Words

Dec 20, 2013

I have written below program to count number of words and lines and print the all the words.

#include <iostream>
using namespace std;
#include<fstream>
#include<string.h>
int main() {
ofstream outfile;

[Code] .....

Its compiling fine but when executed its displaying I infinite times...

View 3 Replies View Related

C/C++ :: Find Max Number Entered By User And Terminate When Negative Number Entered

Jul 15, 2014

I am trying to find the max number entered by the user, and it should terminate when a negative number is entered. For my code, it will just end when the user inputs a lower number than the previous. i.e.- 10 20 15 "The highest number is 20" when it should be "10 20 5 40 15 -1" "The highest number is 40". No arrays or do/while loops either.

#include <iostream>
using namespace std;
int Max(int x);
int main() {
int x;

[Code] ....

View 9 Replies View Related

Visual C++ :: Read Some Text And Output Without Displaying Repeating Words

Sep 8, 2014

I have been given an assignment to make a code to read some text nd display all the words nd the number of times they appear in another file or as output without displaying the repeating words. I made the code but its not giving any output.

#include<iostream>
#include<conio.h>
#include<fstream>
#include<string>
using namespace std;
void read(string);
string x,z,w;

[Code] ....

View 3 Replies View Related

C :: Counting Words In Files By Using Nftw Function

Mar 6, 2015

I'm trying to read files, count words in the files and go in directories. The problem is how I return numbers of total words and total directories. When it comes to nftw(), I am little confused.

Code: /*
*
*
*
* Usage:
*
* ./countWord <path>
*/

#define _XOPEN_SOURCE 700
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdlib.h>

[Code] ....

View 7 Replies View Related

C++ :: How To Pick One Of Words Randomly From Text Instead Of Using All Words In It

May 19, 2013

I was reading this earlier [URL] ..... and I was trying to figure out how to pick one of the words randomly from my text instead of using all the words in it.

View 4 Replies View Related

C++ :: Reversing A String

Feb 26, 2015

I have this bit of code that reverses a string but there's a bit of it that I just don't understand:

int main()
{
char sentence[20]; //Create char array
void reverse( const char * const sPtr );
printf( "Enter your text please:
" );

[code]....

I just don't get how this bit results in the entered string being reverse.how to make code look like code.

View 6 Replies View Related

C :: Display Function Displays All Letters Of Word Entered Instead Of Word Itself

Feb 18, 2013

I am building a linked list and i need to display function i have. The display function displays all the letters of the word entered instead of the word itself. below is my struct, one of my functions and the display function.

Code:

//-----------struct ------------//
struct Node
{
char data;
struct Node *next;
}*Head;

[code]....

View 1 Replies View Related

C :: Reversing A String Using Pointers

Nov 13, 2013

everything seems to be right in this program except that the puts() function does not print anything.

Code:

/*c program to reverse a string using pointer*/
#include<stdio.h>
#include<conio.h>
#include<string.h>
}

[code]....

View 4 Replies View Related

C :: Reversing Elements In Array

Apr 15, 2014

Write the definition of a function reverse , whose first parameter is an array of integers and whose second parameter is the number of elements in thearray . The function reverses the elements of the array . The function does not return a value .

Code:
void reverse(int a[], int num) {
for ( int i=0; i <= num/2 ; i++){
int temp = a[i];
a[i] = a[num-i-1];
a[num-i-1] = temp;
} }

This is supposed to be the answer but I'm not quite sure why this is. I understand everything up until the actual loop. For one, shouldn't "int i" be declared outside the loop (I thought perhaps this was an error in the solutions)?

The main thing that I do not understand is the conditional statement.

Code: i<=num/2;

I don't understand why the "num/2" is necessary here. Also I can't really remember but is there a command that actually reverses an array?

View 5 Replies View Related

C++ :: Reversing Linked List?

Sep 12, 2013

Code is:

#include<stdio.h>
struct node {
int info;
struct node *next,*prev;

[Code] ....

How to reverse a linked list .....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved