Click here to Skip to main content
15,899,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: My xp application can't support vista Pin
Stuart Dootson7-Apr-09 21:41
professionalStuart Dootson7-Apr-09 21:41 
QuestionMFC Conversion to Unicode in VS2008 Pin
Selumbei7-Apr-09 16:32
Selumbei7-Apr-09 16:32 
AnswerRe: MFC Conversion to Unicode in VS2008 Pin
Stuart Dootson7-Apr-09 21:44
professionalStuart Dootson7-Apr-09 21:44 
GeneralRe: MFC Conversion to Unicode in VS2008 Pin
Selumbei8-Apr-09 13:12
Selumbei8-Apr-09 13:12 
QuestionHow do I launch a process as user "Administrator"? Pin
PeniWize7-Apr-09 16:32
PeniWize7-Apr-09 16:32 
AnswerRe: How do I launch a process as user "Administrator"? Pin
«_Superman_»7-Apr-09 18:01
professional«_Superman_»7-Apr-09 18:01 
GeneralRe: How do I launch a process as user "Administrator"? Pin
PeniWize8-Apr-09 9:00
PeniWize8-Apr-09 9:00 
QuestionHELP PLEASE!! Character strings.. PROBLEMS!! using pointers Pin
JasonSprosty7-Apr-09 15:12
JasonSprosty7-Apr-09 15:12 
I am having some problems with the code I am writing.. here is the error message I'm getting:

error C2664: 'getFirst' : cannot convert parameter 1 from 'char (*)[100]' to 'char *'

And here is the code that is involved..

#include <iostream>
#include <cstdlib>

using namespace std;

bool getFirst(char *);
bool getLast(char *);

void main()
{
char firstName[100];
char lastName[100];
bool validFName;
bool validLName;
int first;
int last;
int length;


do
{
cout << "Enter your first name in lowercase letters: ";
validFName = getFirst(&firstName);
if (!validFName) cout << "Invalid entry. Try again...\n";
} while (!validFName);

cout << "\n";

do
{
cout << "Enter your last name in lowercase letters: ";
validLName = getLast(&lastName);
if (!validLName) cout << "Invalid entry. Try again...\n";
} while (!validLName);



cout << "\nYour full name is " << firstName << " " << lastName << "\n";
first = strlen(firstName);
last = strlen(lastName);
length = (first + last);
cout << "\nYour full name has " << length << " characters\n";

}

bool getFirst(char *first)
{
int iF,lenF;
char bufFirst[100];
bool validFirst = true;

cin.getline(bufFirst,100);
lenF = strlen(bufFirst);
iF = 0;
while (validFirst && iF < lenF)
{
if ((bufFirst[iF] < 'a') || (bufFirst[iF] > 'z'))
validFirst = false;
iF++;
}

return validFirst;
}

bool getLast(char *last)
{
int iL,lenL;
char bufLast[100];
bool validLast = true;

cin.getline(bufLast,100);
lenL = strlen(bufLast);
iL = 0;
while (validLast && iL < lenL)
{
if ((bufLast[iL] < 'a') || (bufLast[iL] > 'z'))
validLast = false;
iL++;
}
return validLast;
}


I cannot figure out how to get the correct output.. It displays crazy characters and says that my string length is 330 characters long..

Any help with this please??
AnswerRe: HELP PLEASE!! Character strings.. PROBLEMS!! using pointers Pin
«_Superman_»7-Apr-09 18:03
professional«_Superman_»7-Apr-09 18:03 
QuestionCan't intall latest SDK for V6.0 Pin
Member 11885607-Apr-09 10:58
Member 11885607-Apr-09 10:58 
QuestionCView Window ? Pin
sabdalla807-Apr-09 9:49
sabdalla807-Apr-09 9:49 
QuestionRe: CView Window ? Pin
CPallini7-Apr-09 9:56
mveCPallini7-Apr-09 9:56 
AnswerRe: CView Window ? Pin
sabdalla807-Apr-09 10:34
sabdalla807-Apr-09 10:34 
QuestionHighlighting HTML text Pin
rp_suman7-Apr-09 7:32
rp_suman7-Apr-09 7:32 
AnswerRe: Highlighting HTML text Pin
«_Superman_»7-Apr-09 18:11
professional«_Superman_»7-Apr-09 18:11 
QuestionMembers Named using Template Parameters Pin
Skippums7-Apr-09 5:59
Skippums7-Apr-09 5:59 
AnswerRe: Members Named using Template Parameters Pin
Roger Stoltz7-Apr-09 6:27
Roger Stoltz7-Apr-09 6:27 
GeneralRe: Members Named using Template Parameters Pin
Skippums7-Apr-09 7:19
Skippums7-Apr-09 7:19 
AnswerRe: Members Named using Template Parameters Pin
Stuart Dootson7-Apr-09 8:04
professionalStuart Dootson7-Apr-09 8:04 
QuestionMultiple Directories selection Pin
ranjith_adapu7-Apr-09 5:38
ranjith_adapu7-Apr-09 5:38 
QuestionRe: Multiple Directories selection Pin
Michael Schubert7-Apr-09 6:12
Michael Schubert7-Apr-09 6:12 
AnswerRe: Multiple Directories selection Pin
ranjith_adapu7-Apr-09 19:45
ranjith_adapu7-Apr-09 19:45 
QuestionRe: Multiple Directories selection Pin
David Crow7-Apr-09 6:18
David Crow7-Apr-09 6:18 
AnswerRe: Multiple Directories selection Pin
«_Superman_»7-Apr-09 18:17
professional«_Superman_»7-Apr-09 18:17 
QuestionFSM data structure design Pin
syuga7-Apr-09 5:06
syuga7-Apr-09 5:06 

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.