473,776 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help Asap Debugging My Program

15 New Member
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(i nt [], int);
int main()
{
char names [numNames][nameSize]=
{"Collins,Bill" ,
"Smith,Bart ",
"Allen,Jim" ,
"Griffin,Ji m",
"Stamey,Mar ty",
"Rose,Geri" ,
"Taylor,Ter ri",
"Johnson,Ji ll",
"Allison,Je ff",
"Looney,Joe "};

showArray(names[10],numNames);

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

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

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

for(counter = 0; counter < (SIZE - 1); counter++)
minRow = counter;
strcpy =(minValue,arra y[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 1302
horace1
1,510 Recognized Expert Top Contributor
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
1954
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 past 2 weeks now i give up and call for help. Please if anyone can gide me through i will be so grateful!! I have pasted my code below
14
1732
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 http://www-igm.univ-mlv.fr/~lecroq/string/node14.html. But unfortunately, this source code (see below) somtimes causes a stack corruption when I compile and run it. #define ASIZE 256 //binary
4
1530
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 program. What's happening is when the program is running, it runs into an exception error and switches back to the Visio Studio screen. The problem is that it's not showing me the line of code which actually caused the exception. Instead it is...
5
1374
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 but there is no way to break the cycle! and so I have tried a "while" method too but our handbook fails to specify how to stop a program. please help me asap!
15
2581
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 determine who needs to receive the text message then send the message to the address. Only problem is, the employee may receive up to 4 of the same messages because each thread gets the recors then sends the message. I need somehow to prevent...
0
1151
by: jgill | last post by:
Hello, To start with here is the code: Public Function Paymentget (s12MoRate) strCompanyCode = objXML.selectSingleNode("policy/companyCode").text strState = objXML.selectSingleNode("policy/insured/state").text set rsDownPayment = getCache("down_payment")
3
1143
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 - Shapes</TITLE> </HEAD> <BODY> <OBJECT ID = "shapes" STYLE = "background-color: #CCCCFF; width: 500; height: 400" CLASSID = "CLSID:369303C2-D7AC-11d0-89D5-00A0C90833E6"> <PARAM NAME = "Line0001" VALUE = "SetLineColor( 0, 0, 0 )">
2
1452
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. MCA
9
2743
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 in. My business classes are, of course, decorated with the: <System.ComponentModel.DataObject() attribute. So, I drop a GridView on a webform and set its datasource to an ObjectDatasource which in turn is using one of my business logic...
0
9628
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9464
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10289
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7471
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.