Click here to Skip to main content
15,913,722 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: ImageFormat Pin
Jon Sagara28-Feb-04 7:47
Jon Sagara28-Feb-04 7:47 
GeneralRe: ImageFormat Pin
Stephane Rodriguez.2-Mar-04 6:35
Stephane Rodriguez.2-Mar-04 6:35 
GeneralDataSet Clear() performance problem Pin
Dan Bunea27-Feb-04 1:00
Dan Bunea27-Feb-04 1:00 
GeneralRe: DataSet Clear() performance problem Pin
apferreira27-Feb-04 7:15
apferreira27-Feb-04 7:15 
GeneralRe: DataSet Clear() performance problem Pin
Dan Bunea27-Feb-04 7:20
Dan Bunea27-Feb-04 7:20 
GeneralRe: DataSet Clear() performance problem Pin
apferreira27-Feb-04 7:33
apferreira27-Feb-04 7:33 
GeneralRe: DataSet Clear() performance problem Pin
Dan Bunea28-Feb-04 23:11
Dan Bunea28-Feb-04 23:11 
GeneralCalling a function in C++.NET Pin
benibo26-Feb-04 20:09
benibo26-Feb-04 20:09 
I need help folks,me and a couple of my friends spent the better part of 14 hours trying to figure out this code.The object of the code is to find a person's socioeconomic class based on their income.We are using functions for this but the problem is that when i run the program,the console prompts me for income after it has displayed the other information.Below is the code attached please if a good samaritan can look at this code and tell me what i can do to fix it.Thank you.



include "stdafx.h"

#using <mscorlib.dll>
#include <tchar.h>

using namespace System;

// Prototype for Functions
String *GetFirstName(void);
String *GetLastName(void);
String *GetSocSecNum(void);
String *GetGender(void);
int GetAge(void);
double GetIncome(void);


void DisplayOutput(String*, String*, String*, String*, int);

//This is the entry point for this application
int _tmain(void)
{
//Declaration of Variables
String *FName;
String *LName;
String *SSN;
String *Gender;



double Income;

int Age;
wchar_t Next;

do
{
FName = GetFirstName();
LName = GetLastName();
SSN = GetSocSecNum();
Gender = GetGender();
Age =GetAge();


DisplayOutput(FName, LName, SSN, Gender, Age);
Income = GetIncome();





//Request to do another individual
Console::Write(S"\n\nWould you like to process another
Individual(y/n): ");
Next=Char::Parse(Console::ReadLine());
}while (Next=='y' || Next=='Y');

if (Next=='n' || Next=='N')
//Printout of Information
Console::WriteLine(S"\nGood Bye");

return 0;
}

//Functions:

//Prompt User for First Name
String *GetFirstName(void)
{ Console::Write(S"\nEnter the Individual's First Name: ");
String *FName=Console::ReadLine();
return FName;
}

//Prompt User for Last Name
String *GetLastName(void)
{ Console::Write(S"\nEnter the Individual's Last Name: ");
String *LName=Console::ReadLine();
return LName;
}

//Prompt user for SSN
String *GetSocSecNum(void)
{ Console::Write(S"\nEnter Social Security Number: ");
String *SSN=(Console::ReadLine());
return SSN;
}

//Prompt User for Gender
String *GetGender(void)
{ Console::Write(S"\nEnter the Gender: ");
String *Gender=Console::ReadLine();
return Gender;
}

//Prompt user for Age
int GetAge(void)
{
Console::Write(S"\nEnter Individual's Age: ");
const int Age=Int32::Parse(Console::ReadLine());

return Age;
}
//Display Information
void DisplayOutput(String *FName, String *LName, String *SSN, String
*Gender, int Age)
{
Console::WriteLine(S"\n\t US Census Bureau");
Console::WriteLine(S"\tPersonal Information");
Console::Write(S"\n\tName:\t {0}", FName);
Console::Write(S"\n\tSSN:\t {0}", SSN);
Console::Write(S"\n\tGender:\t {0}", Gender);
Console::Write(S"\n\tAge:\t {0}", Age.ToString());

}

//Prompt User for Income
double GetIncome(void)
{
Console::Write(S"\nEnter Individual's Income: ");
double Income=Double::Parse(Console::ReadLine());
if
(Income>=250000){
Console::Write(S"\n\tSocioeconomic Class: Upper Income");
}
else if
(Income<250000 && Income>=100000){
Console::Write(S"\n\tSocioeconomic Class: Upper Middle Income");
}
else if
(Income<100000&&Income>=50000){
Console::Write(S"\n\tSocioeconomic Class: Middle Income");
}
else if
(Income<50000&&Income>=250000){
Console::Write(S"\n\tSocioeconomic Class: Upper Lower Income");
}

else {
(Income<25000);
Console::Write(S"\n\tSocioeconomic Class: Lower Income");}


return Income;
}




//End Function
GeneralRe: Calling a function in C++.NET Pin
apferreira27-Feb-04 6:12
apferreira27-Feb-04 6:12 
GeneralRe: Calling a function in C++.NET Pin
benibo27-Feb-04 9:29
benibo27-Feb-04 9:29 
Generalusing .NET as a script engine Pin
Nailbite26-Feb-04 18:27
Nailbite26-Feb-04 18:27 
GeneralRe: using .NET as a script engine Pin
apferreira27-Feb-04 7:02
apferreira27-Feb-04 7:02 
GeneralRe: using .NET as a script engine Pin
Judah Gabriel Himango3-Mar-04 12:53
sponsorJudah Gabriel Himango3-Mar-04 12:53 
GeneralDerive C# classes from C++ DLL's Pin
Maxim F.26-Feb-04 4:52
sussMaxim F.26-Feb-04 4:52 
GeneralRe: Derive C# classes from C++ DLL's Pin
Kevin McFarlane27-Feb-04 1:28
Kevin McFarlane27-Feb-04 1:28 
GeneralSoftware Licensing Pin
jmg578526-Feb-04 4:26
jmg578526-Feb-04 4:26 
GeneralRichTextBox.Rtf property Pin
Sreepathi25-Feb-04 9:46
Sreepathi25-Feb-04 9:46 
GeneralRe: RichTextBox.Rtf property Pin
Mazdak26-Feb-04 4:43
Mazdak26-Feb-04 4:43 
GeneralRe: RichTextBox.Rtf property Pin
Sreepathi26-Feb-04 6:26
Sreepathi26-Feb-04 6:26 
GeneralRe: RichTextBox.Rtf property Pin
Bernd Stottmeister27-Feb-04 1:20
Bernd Stottmeister27-Feb-04 1:20 
GeneralRe: RichTextBox.Rtf property Pin
Sreepathi29-Feb-04 17:17
Sreepathi29-Feb-04 17:17 
GeneralCS0234 Pin
Bernd Stottmeister23-Feb-04 20:46
Bernd Stottmeister23-Feb-04 20:46 
QuestionPermission for socket from remote machine? Pin
Dilys23-Feb-04 12:31
Dilys23-Feb-04 12:31 
GeneralP/Invoke blues: htons &amp; htonl issue Pin
Chen Venkataraman23-Feb-04 4:41
Chen Venkataraman23-Feb-04 4:41 
GeneralRe: P/Invoke blues: htons &amp; htonl issue Pin
Chen Venkataraman23-Feb-04 4:43
Chen Venkataraman23-Feb-04 4:43 

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.