| | |
Can Someone Tell me why my program does not run
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2004
Posts: 43
Reputation:
Solved Threads: 0
It is error free but it just doesnt cout for the user to continue or discontinue and it does now stop
C++ Syntax (Toggle Plain Text)
#include <iostream.h> #include <stdlib.h> #include "simmons.h" #include <fstream.h> const int MAXCHARS = 500; char st_line[MAXCHARS]; char ch_option; int i_va; int i_ve; int i_vi; int i_vo; int i_vu; int i_letters = 0; int i_count = 1; int x = 0; int i_vowel = 0; char ch_char; void hope(); void vowels(); void letter(); void mike(); void main() { ifstream HopeData; HopeData.open("getdata"); ofstream MikeData; MikeData.open("putdata"); if(HopeData.fail()) { cout << "\n\nFile not successfully opened\n\n"; } else { cout << "\n\nFile successfully opened\n\n"; } hope(); while(st_line[x] != '\0'); HopeData >> st_line; cin.get(); do{ vowels(); letter(); }while(ch_option != 'y'); mike(); cout << "\n\nDo you want to continue(Y/N)? "; cin.get(ch_option); MikeData << "\nInputted String"; MikeData << "\n\n************************************\n\n" << st_line; MikeData << "\n\nNumber of a's: " << i_va; MikeData << "\nNumber of e's: " << i_ve; MikeData << "\nNumber of i's: " << i_vi; MikeData << "\nNumber of o's: " << i_vo; MikeData << "\nNumber of u's: " << i_vu; MikeData << "\nTotal Vowels: " << i_vowel; MikeData << "\n\nNumber of Letters: " << i_letters; cout << " End of Program"; HopeData.close(); MikeData.close(); } void vowels() { while((ch_char = st_line[x++]) != '\0') switch(ch_char) { case 'a': case 'A': i_va++; break; case 'e': case 'E': i_ve++; break; case 'i': case 'I': i_vi++; break; case 'o': case 'O': i_vo++; break; case 'u': case 'U': i_vu++; break; } i_vowel = i_va + i_ve + i_vi + i_vo + i_vu; } void letter() { for(x=0;x<500;x++) if(st_line[i_letters] == ' ' || st_line[i_letters] == '\0') i_count--; while(st_line[i_letters] != '\0') { if(st_line[i_letters++] != ' ' && (st_line[i_letters++] != ' ' && st_line[i_letters++] != '\0')) i_count++; i_letters++; }
Last edited by alc6379; Nov 30th, 2004 at 5:41 pm. Reason: added [code] tags
I'd need the complete code to get it to compile. And if you want anyone to take a really good look at code, use [CODE][/CODE] tags.
But why do you have a strangely worded loop here?
But why do you have a strangely worded loop here?
while ( st_line[x] != '\0' );![]() |
Similar Threads
- Make a VB Program run in the background? (VB.NET)
- A Program to run a file (C)
- Please correct the error in my program. When i run the program on turbo c++ 3,. (C++)
- My program will not run! (C++)
- VB program run in the Network (Visual Basic 4 / 5 / 6)
- Creating a program to run under various OS (Pascal and Delphi)
- Linker Error when program is run (Urgent help required Please") (C++)
- program won't run (C++)
- Getting an Older Program to Run on Windows XP (Windows tips 'n' tweaks)
Other Threads in the C++ Forum
- Previous Thread: EASY question? checking for line feed (return) in a html file with C++
- Next Thread: octal conversion
Views: 1659 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelper iamthwee ifstream input int integer java lazy lib linkedlist linux loop looping loops map math matrix memory microsoft newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort string strings struct studio system template templates test text tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






