|
 |
|
Dev Articles Community Forums
> Programming
> C/C++ Help
|
"ISO" error on compiler ???
Discuss "ISO" error on compiler ??? in the C/C++ Help forum on Dev Articles. "ISO" error on compiler ??? C/C++ Help forum discussing building and maintaining applications in C/C++. Find out why these languages are the foundation on which other languages are built.
|
|
 |
|
|
|

Dev Articles Community Forums Sponsor:
|
|

March 2nd, 2007, 09:47 AM
|
Registered User
|
|
Join Date: Mar 2007
Posts: 8
Time spent in forums: 25 m 52 sec
Reputation Power: 0
|
|
"ISO" error on compiler ???
Hey guys, im having this problem with my compiler or my code, i dont know which one. everytime i tell it to compile this code, it gives the error "ISO", and i have no idea what that means. here is the code. it happens on lines 15, 19, 23, and all the other if and else if and else lines. whats the problem?
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int Aa = 0, Ee = 0, Ii = 0, Oo = 0, Uu = 0;
int counter;
string str;
int Vowelcount (int Aa,int Ee,int Ii,int Oo,int Uu,string str,int counter)
{
for (counter = 0; (counter - 1) > str.length(); counter++)
{
if (str[counter] == "a")
{
Aa = Aa + 1;
}
else if (str [counter] == "e")
{
Ee = Ee + 1;
}
else if (str [counter] == "i")
{
Ii = Ii + 1;
}
else if (str [counter] == "o")
{
Oo = Oo + 1;
}
else if (str [counter] == "u")
{
Uu = Uu + 1;
}
}
cout << Aa << "\t" << Ee << "\t" << Ii "\t"
<< Oo << "\t" << Uu << endl;
return 0;
}
int main ()
{
cout << "enter a string" << endl;
cin >> str;
counter = 0;
Vowelcount(Aa, Ee, Ii, Oo, Uu, str, counter);
system{"PAUSE");
return 0;
}
|

March 2nd, 2007, 04:22 PM
|
Contributing User
|
|
Join Date: Jan 2005
Posts: 600

Time spent in forums: 2 Days 22 h 40 m 27 sec
Reputation Power: 14
|
|
The "ISO" is not the important part of the error, look at the rest. Anyways, str[counter] is a single char and you compare it to "a", which is actually a string. You meant to compare it to 'a', a character.
|

March 3rd, 2007, 10:18 AM
|
Registered User
|
|
Join Date: Mar 2007
Posts: 8
Time spent in forums: 25 m 52 sec
Reputation Power: 0
|
|
thanks ubergeek
hey ubergeek thanks for the help i got it to take away the ISO error, by the way that was all that was shown, but now when im in runtime, it returns 0 for the variable Aa. whats happening now?
|

March 3rd, 2007, 01:34 PM
|
Contributing User
|
|
Join Date: Jan 2005
Posts: 600

Time spent in forums: 2 Days 22 h 40 m 27 sec
Reputation Power: 14
|
|
I'm not quite sure, my psychic powers are off today. What is the updated code? And what did you give it as input?
|

March 4th, 2007, 09:33 AM
|
Registered User
|
|
Join Date: Mar 2007
Posts: 8
Time spent in forums: 25 m 52 sec
Reputation Power: 0
|
|
hey thanks again ubergeek heres the code
#include <cstdlib>
using namespace std;
int Aa = 0, Ee = 0, Ii = 0, Oo = 0, Uu = 0;
int I;
string str;
int Vowelcount (int Aa,int Ee,int Ii,int Oo,int Uu,string str,int I)
{
for (I=0;I>str.length();I++)
{
if (str [I] == 'a')
{
Aa = Aa + 1;
}
else if (str [I] == 'e')
{
Ee = Ee + 1;
}
else if (str [I] == 'i')
{
Ii = Ii + 1;
}
else if (str [I] == 'o')
{
Oo = Oo + 1;
}
else if (str [I] == 'u')
{
Uu = Uu + 1;
}
}
return Aa;
}
int main ()
{
cout << "enter a string" << endl;
cin >> str;
Vowelcount(Aa, Ee, Ii, Oo, Uu, str, I);
cout << Aa;
string red;
cin >> red;
return 0;
}
|

March 4th, 2007, 01:35 PM
|
Contributing User
|
|
Join Date: Jan 2005
Posts: 600

Time spent in forums: 2 Days 22 h 40 m 27 sec
Reputation Power: 14
|
|
Your organization doesn't make much sense to me. You have Aa and the rest as global variables (so all functions can access them), but then you pass them to Vowelcount() anyways. Then Vowelcount returns a value, but you ignore it and output the global variable instead (this is why you see 0 output--the global variable was copied when you passed it to Vowelcount and never modified). Review global variables and function parameters/return values.
|

March 5th, 2007, 01:03 PM
|
Registered User
|
|
Join Date: Mar 2007
Posts: 8
Time spent in forums: 25 m 52 sec
Reputation Power: 0
|
|
hey thankyou so much ubergeek that was mighty bitchin in the kitchen.
|
Developer Shed Advertisers and Affiliates
Thread Tools |
Search this Thread |
|
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|