| | |
Why Wont my If Work
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
New Problem... it keeps outputting both under and over par grrrrrrrrrr
whats wrong with my if statement??!!
whats wrong with my if statement??!!
C++ Syntax (Toggle Plain Text)
if (StrokeCount == 5 ) { cout<< "You are on Par Way To Go!!"<<endl; cout << endl; } else if (StrokeCount < 5) { Par = 5%StrokeCount; cout <<" You are "<< Par <<" under Par" << endl; cout << endl; } else if (StrokeCount > 5 ) Par = StrokeCount%5; cout <<" You are "<< Par <<" over Par" << endl; cout << endl;
Too scared to show my code in case its laughable :o
you forgot to block in the code for the last if statement.
if (StrokeCount > 5 ) { Par = StrokeCount%5; cout <<" You are "<< Par <<" over Par" << endl; cout << endl; }
if (StrokeCount == 5 )
{
cout<< "You are on Par Way To Go!!"<<endl;
cout << endl;
}
else
if (StrokeCount < 5)
{
Par = 5%StrokeCount;
cout <<" You are "<< Par <<" under Par" << endl;
cout << endl;
}
else
if (StrokeCount > 5 )
{
Par = StrokeCount%5;
cout <<" You are "<< Par <<" over Par" << endl;
cout << endl;
}What did I tell you about the Tabs and Spaces?It is difficult to read code like this. All the formatting is lost.
バルサミコ酢やっぱいらへんで
![]() |
Similar Threads
- Help! My mouse wont work! (USB Devices and other Peripherals)
- mouse wont work! (Windows NT / 2000 / XP)
- Restart/shutdown&ctrl+alt+del wont work (Windows NT / 2000 / XP)
- fitting g force graphic card wont work(athlon m/b) (Monitors, Displays and Video Cards)
- IE wont work with Antivirus Software (Web Browsers)
- IE wont work :-( (Web Browsers)
- Sound Card won't work on laptop (*nix Hardware Configuration)
Other Threads in the C++ Forum
- Previous Thread: Assistance Required
- Next Thread: Sorting a 2d array of strings in C++??
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock wordfrequency wxwidgets






