| | |
Creating an OS
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2006
Posts: 103
Reputation:
Solved Threads: 0
That was FUN!!!
But ERROR
a < 5 // Checks to see if a is less than five
a > 5 // Checks to see if a is greater than five
a == 5 // Checks to see if a equals five, for good measure
Could not compile
[code=c++ a < 5 // Checks to see if a is less than five
a > 5 // Checks to see if a is greater than five
a == 5 // Checks to see if a equals five, for good measure
[/code]
But ERROR
a < 5 // Checks to see if a is less than five
a > 5 // Checks to see if a is greater than five
a == 5 // Checks to see if a equals five, for good measure
Could not compile
[code=c++ a < 5 // Checks to see if a is less than five
a > 5 // Checks to see if a is greater than five
a == 5 // Checks to see if a equals five, for good measure
[/code]
Those aren't entire C++ statements. They're just examples, or "snippets". For example, you could use one of the expressions like the following:
Those expressions at the end of the tutorial were just examples. I hope this makes sense.
c++ Syntax (Toggle Plain Text)
#include <iostream> int main() { int a = 6; if (a>5) { std::cout << "The variable 'a' is larger than 5.\n"; } }
Those expressions at the end of the tutorial were just examples. I hope this makes sense.
Last edited by John A; Oct 31st, 2006 at 7:39 pm.
"Technological progress is like an axe in the hands of a pathological criminal."
Usually you want
On many compilers,
cin.get to execute when your program finishes on a compiler like Dev-C++. Why? Because users will usually double-click on your app, which will open a DOS prompt window, and when the program is done, the window will close immediately, so the user can't see the final messages printed out by the program.On many compilers,
cin.get is not needed, automatically append code to do this (Such as Visual C++) to save you the trouble. "Technological progress is like an axe in the hands of a pathological criminal."
Loops are a very important constructs in programming.
Imagine you want to gather data from 100 clients and put it in an array of client data. Imagine doing that without loop:
With loops its like:
Hope you get the drift...
Imagine you want to gather data from 100 clients and put it in an array of client data. Imagine doing that without loop:
c Syntax (Toggle Plain Text)
cout << "Enter data of client 1: " ; cin >> record[0] ; cout << "Enter data of client 2: " ; cin >> record[1] ; cout << "Enter data of client 3: " ; cin >> record[2] ; // ... and so on till 100
With loops its like:
c Syntax (Toggle Plain Text)
for( int i = 0; i < 100; ++i ) { cout << "Enter data of client " << i + 1 << ": " ; cin >> record[i] ; } // end of data gathering phase
Hope you get the drift...
I don't accept change; I don't deserve to live.
![]() |
Similar Threads
- Help in Creating a Forum (Web Hosting Deals)
- Creating a Boot Disk for an NTFS or FAT Partition (Windows tips 'n' tweaks)
- Creating an OS in visual basic 6.0 (Visual Basic 4 / 5 / 6)
- Creating a disk image (OS X)
- Error message when creating PDF (OS X)
- Creating a Address Book using Random Access Files (Visual Basic 4 / 5 / 6)
- Creating and destroying objects (C++)
Other Threads in the C++ Forum
- Previous Thread: Function Back to Main
- Next Thread: help for building a USB driver for windows?
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






