Click here to Skip to main content
15,913,773 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHelp me,I happen to a error about the compliler in VC6.0 Pin
onlysaint3-Apr-06 16:24
onlysaint3-Apr-06 16:24 
AnswerRe: Help me,I happen to a error about the compliler in VC6.0 Pin
includeh103-Apr-06 20:48
includeh103-Apr-06 20:48 
QuestionHow to touch member variable from a exported dll class Pin
sting_lee3-Apr-06 16:23
sting_lee3-Apr-06 16:23 
QuestionDSOFramer in MFC Dialog Pin
Jenleonard3-Apr-06 14:13
Jenleonard3-Apr-06 14:13 
Question2D array help Pin
juztten3-Apr-06 14:07
juztten3-Apr-06 14:07 
AnswerRe: 2D array help Pin
Saurabh.Garg3-Apr-06 15:26
Saurabh.Garg3-Apr-06 15:26 
AnswerRe: 2D array help Pin
juztten3-Apr-06 16:25
juztten3-Apr-06 16:25 
Questionhelppp Pin
slurpyz3-Apr-06 13:06
slurpyz3-Apr-06 13:06 
A game to transform letters read from a file to a prime number. Do and enjoy it!

The goal of this is to construct a C++ program that will read all letters from a specified file and transform them to a prime number.

The tasks you have to perform are:

(A) Read letters in sequence from a specified file, which contains 1 sentence. Transform each letter to the corresponding ASCII value.

For example, if the file contains “What?” then

‘W’ corresponds to 87

‘h’ corresponds to 104

‘a’ corresponds to 97

‘t’ corresponds to 116

(B) Calculate and output r1=the sum of all obtained integers (e.g. r1=87+104+97+116=404)

(C) Calculate and output r2=the length of Syracuse sequence seeded by r1.

Let n be a positive integer and f(n) be the transformation that sends n to n/2 if n is even and sends n to 3n+1 if n is odd. Starting with a positive value u called the seed, the sequence of integers iteratively generated by f and u is called a Syracuse sequence.


For example, starting with the seed u = 1, the subsequent terms of the sequence are 4, 2, and 1. The length of the sequence (excluding the seed) is therefore 3.


For u = 4, the next terms are 2 and 1. The length is 2.


For u = 404, the next terms are 202, 101, 304, 152, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, and 1. The length is 27.


It is conjectured (this means that we do not have a proof of this fact, only strong evidences) that for any positive seed the sequence will always reach to 1. In fact, computations show that for any seed u less than or equal to 3*2^53, the corresponding sequence always reaches 1. The general case is unknown.

(D) Calculate and output r3=the largest prime factor of r2.

A prime factor of n is a factor of n which is a prime number. A prime number is any integer greater than 1 and only divisible by itself and 1 (e.g. 2, 3, 5, 7, 11, 13, 17 etc). For example, 3 is the largest prime factor of 27 and 7 is the largest prime factor of 49.

Here are some example
Example 1
Enter the name of the input file: in1.txt
963
49
7

Press CTR-C to Leave...

AnswerRe: helppp Pin
Ryan Binns3-Apr-06 18:35
Ryan Binns3-Apr-06 18:35 
GeneralRe: helppp Pin
toxcct3-Apr-06 22:00
toxcct3-Apr-06 22:00 
GeneralRe: helppp Pin
Rudolf Jan4-Apr-06 0:35
Rudolf Jan4-Apr-06 0:35 
QuestionCList question concerning arrays Pin
brdavid3-Apr-06 12:48
brdavid3-Apr-06 12:48 
AnswerRe: CList question concerning arrays Pin
Iain Clarke, Warrior Programmer3-Apr-06 13:32
Iain Clarke, Warrior Programmer3-Apr-06 13:32 
GeneralRe: CList question concerning arrays Pin
brdavid3-Apr-06 14:21
brdavid3-Apr-06 14:21 
QuestionHelp on error C2632: 'char' followed by 'char' is illegal Pin
pavanbabut3-Apr-06 11:28
pavanbabut3-Apr-06 11:28 
AnswerRe: Help on error C2632: 'char' followed by 'char' is illegal Pin
includeh103-Apr-06 12:24
includeh103-Apr-06 12:24 
GeneralRe: Help on error C2632: 'char' followed by 'char' is illegal Pin
pavanbabut3-Apr-06 12:41
pavanbabut3-Apr-06 12:41 
GeneralRe: Help on error C2632: 'char' followed by 'char' is illegal Pin
includeh103-Apr-06 12:51
includeh103-Apr-06 12:51 
GeneralRe: Help on error C2632: 'char' followed by 'char' is illegal Pin
pavanbabut3-Apr-06 13:34
pavanbabut3-Apr-06 13:34 
GeneralRe: Help on error C2632: 'char' followed by 'char' is illegal Pin
Amit Agarrwal3-Apr-06 19:05
Amit Agarrwal3-Apr-06 19:05 
GeneralRe: Help on error C2632: 'char' followed by 'char' is illegal Pin
pavanbabut3-Apr-06 19:08
pavanbabut3-Apr-06 19:08 
GeneralRe: Help on error C2632: 'char' followed by 'char' is illegal Pin
Amit Agarrwal3-Apr-06 19:38
Amit Agarrwal3-Apr-06 19:38 
GeneralRe: Help on error C2632: 'char' followed by 'char' is illegal Pin
pavanbabut4-Apr-06 18:30
pavanbabut4-Apr-06 18:30 
QuestionProgress dialog for long-time processing Pin
JRGlide3-Apr-06 11:21
JRGlide3-Apr-06 11:21 
AnswerRe: Progress dialog for long-time processing Pin
Ryan Binns3-Apr-06 18:42
Ryan Binns3-Apr-06 18:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.