473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help Asap Debugging My Program

I am trying to write a program which sorts an array of supplied names.

Here are the errors i am getting.


33: error: expected unqualified-id before "for"
37: error: expected declaration before '}' token


AND HERE IS MY CODE

#include <iostream>
using namespace std;

const int numNames = 10;
const int nameSize = 17;
void showArray(char [],char);
void selectionSort(int [], int);
int main()
{
char names [numNames][nameSize]=
{"Collins,Bill",
"Smith,Bart",
"Allen,Jim",
"Griffin,Jim",
"Stamey,Marty",
"Rose,Geri",
"Taylor,Terri",
"Johnson,Jill",
"Allison,Jeff",
"Looney,Joe"};

showArray(names[10],numNames);

}
void showArray(char array [], char SIZE);

for(counter = 0, counter < size, counter++)
{
cout << array[count] << endl;
}
}

void selectionSort(char array[],[nameSize],int size)
{
cin counter, minRow;
char minValue[17];

for(counter = 0; counter < (SIZE - 1); counter++)
minRow = counter;
strcpy =(minValue,array[counter]

for(int index = counter+1; index < SIZE; index++)
{ if(strcmp(array[index],minValue)<0)
strcpy(minValue,array[index]);
minRow = index;
}




Any help is greatly appreciated.
Nov 11 '06 #1
1 1291
horace1
1,510 Expert 1GB
there were a few errors in function showArray(), e.g.
Expand|Select|Wrap|Line Numbers
  1. void showArray(char array [], char size)  // ** removed ; change SIZE to size
  2. {                                         // ** added {
  3. for(int counter = 0; counter < size; counter++)   // ** replace, with ;
  4. {
  5. cout << array[counter] << endl;                   // ** changed count to counter
  6. }
  7. }
  8.  
now try and find errors in the rest of the code
Nov 11 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the ...
14
by: Peter Schmitz | last post by:
Hi, I'm currently developing an application that includes an implementation of the well-known Boyer- Moore algorithm. For this, I use the implementation of Thierry Lecrq from...
4
by: Jason Hunt | last post by:
I'm hoping someone can help me out with using the Visual Studio IDE for debugging. I'm working on a Windows Forms application (it's an MDI if it matters), and I'm trying to fix a bug in my...
5
by: ToAsTeEJaVa | last post by:
I need to repeat a set of instructions but if the user enters a certain character or number e.g. 0; the program should stop... what methods can I use for this? I have tried to use a "for" method...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
0
by: jgill | last post by:
Hello, To start with here is the code: Public Function Paymentget (s12MoRate) strCompanyCode = objXML.selectSingleNode("policy/companyCode").text strState =...
3
by: rawat26 | last post by:
I am trying to run a DHTML program.. but it show me an error... "Object does not support the property or method". My program is written below.. <HTML> <HEAD> <TITLE>Structured Graphics -...
2
by: jafarsibtain | last post by:
hi.. I am creating a form where there are two combo Boxes (drop Down) > Program_Combo_box > Course_Code_Combo in the Program Combo Box there are five items in the list > 1. BIT 2.BCA 3....
9
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.