C++ :: Find Longest Name / Display It And Tell How Many Letters It Have

Feb 27, 2014

I am trying to make a program into which you writre for example ten Names or words or etc. and it would find the longest name/word write it and the numbers of characters too but I have problem with displaying that name. Here is me source code, the problem is here "vitaz=szInput;" i don't know how to save that longest name/word.

#include <cstdlib>
#include <iostream>
#include <string.h>
using namespace std;
int main () {
char a;
char szInput[256],vitaz[256];

[Code] .....

View 5 Replies


ADVERTISEMENT

C/C++ :: Find Last Longest Word In A String

Apr 29, 2015

How to find the last longest word in a string when there are more of them (with the longest size)?

Here is the program for the longest without checking if last:

#include<stdio.h>
#include<string.h>
int main() {
char a[50],b[20],c[20];
int i,j=0,l=0;
printf("Enter a string:
");
gets(a);

[Code] ....

View 6 Replies View Related

C :: How To Find Longest Series Of Even And Positive Numbers

Mar 6, 2015

Example input: 2 4 6 -1 7 3 -2 1

Output: 3 3 (longest series of even is 3, longest series of positive is 3)

Here is the code:

Code:

#include <stdio.h>
int even(int x) {
return x % 2 == 0;
}
int positive(int x) {
return x>0;

[Code]...

My question is how to write this code if the prototype of function is:

Code: void series(int *array, int n, int (*s)(int), int **begining, int *lenght);

View 1 Replies View Related

C/C++ :: Find Longest Series Of Even And Positive Numbers?

Mar 16, 2015

program:

Example input: 2 4 6 -1 7 3 -2 1
Output: 3 3 (longest series of even is 3, longest series of positive is 3)

Here is the code:

#include <stdio.h>
int even(int x) {
return x % 2 == 0;
}

[Code].....

My question is how to write this code if the prototype of function is:

void series(int *array, int n, int (*s)(int), int **beginning, int *length);

View 1 Replies View Related

C++ :: Given A String How To Find Longest Substring With All Unique Characters

Feb 9, 2015

I am new to C++ programming, writing a program for the below question:

given a string, how to find the longest substring with all unique characters.

View 1 Replies View Related

C++ :: Program That Uses Recursion To Find Longest Increasing Sequence From A Grid In File

Mar 25, 2013

Any examples of a c++ program that uses recursion to find the longest increasing sequence from a grid in a file. Like

2 4 6 8
10 12 14 16
18 20 22 24

I have to use a structure named Point and a structure named Sequence.

const int MAXROWS = 4;
const int MAXCOLS = 4;
const int MAXFILENAME = 255;
// Structure used to define a point (x,y) in the grid.
typedef struct {
int x, y;

[Code] .....

View 1 Replies View Related

C :: How To Count And Display Palindrome Words In A Randomized Letters

Oct 11, 2013

how to count and display the palindromes in this randomized letters:

this is my program but it only prints randomized letters and can't count the palindromes words and display it:

Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

[Code].....

View 2 Replies View Related

C :: Find Number Of Capital Letters And Punctuations In A String

Jan 28, 2015

write a C program which repeatedly reads in sentences from the user and reports on how many capital letters are in the sentence and how many punctuation characters. Your program will stop asking for input once the user has entered in a blank line. Consider the following example usage with the program. User input is marked in underline:

Enter a sentence: John and Mary went to Fred's house.
You used 3 capital letters and 2 punctuation characters.
Enter a sentence: I like A&W more than McDonald's.
You used 5 capital letters and 3 punctuation characters.
Enter a sentence:
Good bye!

Hint: make use of the standard C functions ispunct and isupper. Other requirements. You must make two functions.

Make a function called find_characters, which has a return type of void, and which has three parameters: one of type char * (a string to find characters in), one of type int * (a reference to int variable indicating how many capital letters are in the string) and the last one also of type int * (a reference to an int variable indicating how many punctuation characters are in the string). Your find_characters function should scan the string and update the two variables it has references to.Make a main function.

This function should repeatedly read in a string from the user, call your find_characters function, and output the information returned to it by the find_characters function indicating how many capital letters and how many punctuation characters were in the string. Your main function should stop reading in input when the user enters in a blank string (i.e., the user just hits enter without entering anything else in). You may assume that the user will not enter in a sentence longer than 100 characters

Code:
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>

int main(void) {

[Code] .....

View 9 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++ :: Longest String Does'n Print On Same Line

Aug 4, 2014

I try to learn string class, resolving some problem, but i have some dificulties.The is ok, but when i print the longest string it does'n print on the same line.I enter the number of string, after that i enter the first string until i introduced from keyboard "#" character. I enter the second string and so on.Look at these example :

For i = 3;

Text[0] : I learn class String#
Text[1] : I dont learn class String#
Text[2] : String#

It print me like that : Text[1] :

I dont learn class String More than that look at the next example :

For i = 3;

Text[0] : I learn class String#abcdef
Text[1] : I dont learn class String#
Text[2] : String#

You see that in the first sentence i have continue to introduce some characters after # character and look what is happened :

Text[1] : abcdef
I dont learn class String

#include<iostream>
#include<string>
using namespace std;
int main() {
string text[100], cuvant;
int i, j, m, lung = 0;
cout << "

[code]....

View 3 Replies View Related

C++ :: Implementation Of Longest Common Subsequence

Sep 11, 2014

In the implementation of a program to find the length of the longest common subsequence, what does line 14 do?

void lcs( char *X, char *Y, int m, int n )
{
int L[m+1][n+1];
/* Following steps build L[m+1][n+1] in bottom up fashion. Note
that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
for (int i=0; i<=m; i++)

[Code].....

View 2 Replies View Related

C++ :: Finding The Longest Path In A Graph

Dec 29, 2013

I was asked to find the longest path in a graph. I was thinking about using Dijsktra's algorithm after multiplying all the weights with -1 and run the program in normal way and find the shortest path. And then I'll multiply with -1 again and get the longest path. I think this should give me the longest path, do you think it would work? And also, I'm dealing with considerably big data, such as 1.000.000 nodes and many more edges. etc. and I have a time limit of 2 seconds and memory limit of 128mb. Any other data structure instead of Adjacency Matrix? Because I'm pretty sure it will exceed the limits.

View 2 Replies View Related

Visual C++ :: Getting Longest Word From Array?

Feb 14, 2013

I've noticed around here that using namespace std etc isn't exactly good practice but if I take a code back to my tutor without it I'll get sent back to change it and put it back in. I can't work out how to call the plant with the longest Latin name.

Code:
// Session6_4.cpp : Defines the entry point for the console application.
//For you to do...
#include "stdafx.h"
#include <iostream>

[Code].....

View 1 Replies View Related

C++ :: Getting Longest Sequence In Hailstone Program

Oct 4, 2014

The following is a part of a hailstone cpp program. I want to write an option to let users enter 2 numbers and the program evaluates the longest sequence the number has within the 2-number range and return the count.

Code:
int longestHailstoneSequenceLength(int start, int end)
{
int max = 0;
int s= start;
while (s!=1)

[Code] ....

View 8 Replies View Related

C++ :: Program To Print Longest Common Subsequence?

Sep 12, 2014

I found this implementation on a website for printing the longest common subsequence. But it gives wrong answers for some reason even though the code seems right to me.

Here is the code:

#include <iostream>
int lcs(char *X, char *Y, int m, int n)
{
int L[m+1][n+1];
for(int i = 0; i<=m; i++)

[code].....

What is wrong with this code?

View 7 Replies View Related

C/C++ :: Call To String Function To Display Names In Class Not Display

Apr 19, 2014

I created class called students which suppose to store students names of in array but when I call the display function it display only the first name. but I want it to display names depending on the array size.

#include <iostream>
#include <sstream>
using namespace std;
const int SIZE=5;

[Code]....

View 3 Replies View Related

C :: Binary To Decimal Conversion Through A Port To Display On LCD Display

Dec 6, 2013

I know this is more simple than I am making it out to be. I have a solar panel hooked up to an 8-Bit ADC and linked into my Microprocessor. I am trying to take the Binary readout from the ADC and convert it to a decimal number to be displayed on the boards LCD display. I am wiring the ADC to PORTA on my Motorola Freescale Board. This is for a final project for my electronic systems class due on Monday...

View 3 Replies View Related

C++ :: How To Count Letters

Mar 16, 2013

I'm just trying to find out if the way I've setup my code currently allows me to count the letters as they occur? I don't yet see how to do it but I need clarification. Ideally the function letterCounter would do the counting but atm I'm just trying to figuring it out in the display function.

View 2 Replies View Related

C :: Writing Numbers In Letters?

Jan 26, 2013

Code:
#include<stdio.h>
#include<string.h>
#define a 9
#define b 9
#define c 3
int main() {

[Code] .....

In practice section there was a challenge to print up numbers in letters up to billion including negatives I didn't look at the solution and came up with this but it is getting difficult after this point....

View 9 Replies View Related

C :: Printing A Parallelogram From Letters

Nov 14, 2013

These are the instructions: read a number between 1-26 and build a parallelogram in the size (height&width) of the number entered.

Each row of the parallelogram will be built from each capital letter from 1 to the number read (max 26).for example: by entering the number 3, will be printed:

AAA
_BBB
__CCC

for the number 4:
AAAA
_BBBB
__CCCC
___DDDD

I am struggling with how to change each char in every different row, how do I print this parallelogram ?

View 8 Replies View Related

C :: Converting Letters To Hexadecimal

Jun 3, 2014

i m trying to write a code that would convert a each letter from a text to their decimal images . while i was able to write the part of entering the text , i cant do the converting part , i searched all day on the internet and found nothing.

View 3 Replies View Related

C++ :: How To Read Selected Letters

Jun 1, 2013

I have a text file in which i need to read only selected letters and substitute them with integers to calculate.

Eg:-
In the text file
f2,h1

Here i need to read only the the letters f & h and substitute them with some integer and add them up.

View 1 Replies View Related

C++ :: A Program To Print Big Letters?

Nov 28, 2013

I need help writing a program where I use small letter to write names in Big letters. (I dont know if you understand what i mean). Follow link to description.

[URL]

View 6 Replies View Related

C++ :: Swapping Letters In Array

May 3, 2013

I have a function that is suppose to swap positions of 2 letters but It doesn't seem to work. Im passing in the array of char into the function.

void swapletter(char word[]) {
char temp1;
int swap1;
int swap2;
cout<<"What is the first location: ";
cin>>swap1;

[Code] ....

View 6 Replies View Related

C++ :: How To Put 2 Letters Together And Make Them To Count As 1

Mar 11, 2013

how to put 2 letters together and make them to count as 1?

provided that they must consecutive

for example:

p : count as 0
pxp : count as 0
pp : count as 1
xpxp: count as 0
ppxpp : count as 2

View 1 Replies View Related

C++ :: Capital And Lowercase Letters?

Sep 26, 2013

I am writing a code that requires the user to input either B or b for bright or D or d for dim. Basically, B is bright and D is dim but I have to code the program such that it allows for both he capital letter and the lowercase letter to be recognized.

View 1 Replies View Related







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