Thanks,i was able to resolve the issues that you highlited and it worked just fine.Thank you very much.
benibo
Posts
-
Conversion problems.Please help -
Conversion problems.Please helpThis is my code,it has a few bugs and i have looked over them for hours on end but i am at my wits end,please help a brother out.I have to turn this thin in tomorrow at 9.00AM. //Benibo Ajumogobia //@02087650 //Project 2 //19/09/04 #include "stdafx.h" #using using namespace System; void total (int __gc[]);//Function declaration void sort (int __gc[]); void change (int __gc[], int); int _tmain() { //Declaration of Array int size __gc[] = {40,30,25,15,100,70,95,24,33,26,14,99}; Console::WriteLine(S"The Originalnumbers in the array are:"); for (int i = 0; i< size; i++ ) Console::Write(S" {0}", size[i].ToString()); Console::WriteLine(); void total(size); int even = 0;//declaring even and odd numbers int odd = 0; for(int k = 0; k<= size;k++) { if (size[k] % 2== 0) even = even + 1; else odd = odd + 1; } Console::WriteLine(S"The number of Even Numbers is: {0}",even.ToString()); Console::WriteLine(S"The number of Odd Numbers is: {0}",odd.ToString()); //begin sorting sort(size); Console::WriteLine(S" Numbers in the array in ascending order"); for (int i=0; i <= size; i++) Console::Write(S" {0}", size[i].ToString()); Console::WriteLine(); Console::WriteLine(S"Please press enter to close"); String *exit = Console::ReadLine(); return 0; }// end main //calculate sum void total(int b __gc[]) { int sum = 0; for (int i = 0; i<= b; i++) sum = sum + b[i]; Console::Write(S"The total is:{0}", sum.ToString()); Console::WriteLine(); int avg = sum/12; Console::WriteLine(S"The average is: {0}", avg.ToString()); } //sort numbers void sort (int c __gc[]) { for (int pass = 1; pass<=c; pass++) for (int i = 0; i < c - 1; i++) if (c[i]>c[i+1]) change (c, i); } //Function to change numbers void change(int d __gc[], int first) { int temp; temp = d[first]; d[first] = d[first + 1]; d[first + 1] = temp; } This are the errors that i got and i was able to resolvce some but this ones persist: c:\Documents and Settings\bkajumogobia\My Documents\Visual Studio Projects\Scrap code\Scrap code\Scrap code.cpp(24): error C2446: '<' : no conversion from 'int __gc[]' to 'int' c:\Documents and Settings\bkajumogobia\My Documents\Visual Studio Projects\Scrap code\Scrap code\Scrap code.cpp(24): error C2693: '<' : illegal comparison for references to a __gc array c:\Documents and Settings\bkajumogobia\My Documents\Visual Studio Projects\Scrap code\Scrap code\Scrap code.cpp(29): error
-
HELP!!I code due tomorrowHey thanks but i was able to resolve the issue.It was a very simple one at that and was totally my mistake.I for got to #include tchar.h
-
HELP!!I code due tomorrowyour code gave me an error:LNK2019 unresolved external symbol_main refferenced in function_main CRT startup fatal error LNK1120: 1 unresolved external
-
HELP!!I code due tomorrowAlright i have to write this code that is supposed to calculate the gardes of 10 students and output the highest average abd the student Identification number of the person with the highest average.I am stuck and so is my whole class so please help this is what i ahve so far.Please someone save my life // This is the main project file for VC++ application project // generated using an Application Wizard. #include "stdafx.h" #using #include using namespace System; char grade(int id, int t1, int t2);//function prototype // This is the entry point for this application int _tmain(void) { //declaration char grade; int t1,t2,tot,avg,max,high_avg_id,id,i; max=0; //Processing phase for (i=1;i<=10;i++) { Console::WriteLine(S"Please enter your Student Id: "); id = Int32::Parse(Console::Readline()); Console::WriteLine(S"Please enter Test one score: "); t1 = Int32::Parse(Console::ReadLine()); Console::WriteLine(S"Please enter Test two score: "); t2 = Int32::Parse(Console::ReadLine()); tot = t1 + t2; avg = tot/2; if (max < avg) { max = avg; high_avg_id = id; } if (avg >= 90) grade = 'A'; else if (avg >= 80) grade = 'B'; else if (avg >= 70) grade = 'C'; else if (avg >= 60) grade = 'D'; else grade = 'F'; } return 0 } char grade
-
Calling a function in C++.NETI tried to do that but the thing is that the GetIncome() function that gets called reads a -1E and that is wromg because i want it to read the income in my IF statement.
-
Calling a function in C++.NETI 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 #include 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