954,504 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

help with namespace error

Im getting some interesting error messages when i try to compile my program here is the error messages:

expected unqualified-id before "namespace"
expected `,' or `;' before "namespace"
expected namespace-name before ';' token
'' is not a namespace

Here is my code...any help would be greatly appreciated

#include
#include
#include

using namespace std;
ifstream inData;
ofstream outData;
bool die = 1;
bool sorted = 0;

int main()
{
char choice;
float T[100];
while(die)
{
cin.clear();
Arwork :: Get_Choice(choice); //calls the menu function
Arwork :: Process_Choice(T[],choice);
}
}

void Arwork:: Get_Choice(char choice)
{
outData<> choice;
}

void Arwork::Process_Choice(float T[],char choice,int size)
{
float y = 0;
switch(choice)
{
case 'a':
Load(T,size);
display_Array(T,size);
break;
case 'b': Sort(T,size);
cout<<"Sorted Array: "<> answ;

//Keyborad input
if(answ == 'k')
{
cout<< "Enter all the data at once or (Ctrl-Z to quit)" << endl;
outData<< "Enter all the data at once or (Ctrl-Z to quit)" << endl;

int i =0;
while(cin)
{
cin >> T[i];
outData<< T[i]<< " ";
if(cin) i++;
size++;
}
size = size-1;
}
else
{
//file input
string fileName;

cin.clear();
cout<< "Input file name, then press Ctrl-D, Enter" << endl;
outData<< "Input file name, then press Ctrl-D, Enter" << endl;
cin >> fileName;
inData.open(fileName.c_str());

int i=0;

for (int i = 0; inData>> T[i]; i++)
++size;

size = size-1;
}
}

//sorts the array
void Arwork :: Sort(float T[100], int size)
{


int i, j, smallestAt;

for (int i = 0 ; i < size - 1 ; i++)
{
smallestAt = i;
for (j = i + 1 ; j < size ; j++)
{
if (T [j] < T[smallestAt])
{
smallestAt = j;
}
}

//calls swap
if (smallestAt != i)
{
swap (i, smallestAt, T);
}
}
sorted = true;
}

//swaps the numbers in the array
void Arwork :: swap (int loc1, int loc2,float T[])
{
float temp = T [loc1];
T [loc1] = T [loc2];
T [loc2] = temp;
}

//computes the average
float Arwork:: Average(float T[100], int size)
{
float total = 0.0;
for(int k = 0;k< size;k++)
{
total += T[k];
}

cout< max)
{
max = T[k];
}
}
cout<>target;

int k=0;
while((k< size) && (T[k] < target))
k++;
for(int index = size -1; index>=k;index --)
{
T[index + 1] = T[index];
}

T[k] = target;
size = size + 1;
}

//deletes a number in an array
void Arwork :: Delete(float T[100],int size)
{
float target = 0;
cout<< "Enter the number you wish to delete" <>target;

int k=0;
while((k>target;

int k=0,h=0;
for(h=0;h> num1;

cout<< "Enter your Second Number then press Enter" <> num2;

for(k=0;k > size;k++)
{
if((T[k]>num1)&&(T[k]

Foxtildawn
Newbie Poster
15 posts since Jan 2005
Reputation Points: 10
Solved Threads: 0
 
frrossk
Posting Whiz in Training
220 posts since Sep 2004
Reputation Points: 17
Solved Threads: 9
 
#include <string>
jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You