hi to all of you can you pls give me some basic programs here at C++ i am new to this programing language. thank you anything you post will be helpful chow...:pleased::pleased:
Not sure what you mean by programs... do you mean source? How about inputting a few integers into a vector and then output what's been stored. Code: #include <iostream> #include <vector> int main() { std::vector<int> data; std::vector<int>::iterator it; int num; do { std::cout << "Enter a number (0 to quit): "; std::cin >> num; if(num != 0) { data.push_back(num); } } while(num != 0); for(it = data.begin(); it != data.end(); ++it) { std::cout << "numbers: " << *it << std::endl; } return 0; } I haven't done a lot of coding recently, so I may be a bit rusty. There's no error checking of anykind and you might be better off using stringstreams instead of cin to read the numbers, but hopefully, it will be helpful. Good luck.
hey sir., can you help me bout how to determine the largest or smallest number if i'll input 10 numbers? :0
Code: initialize variables for largest and smallest loop(while inputted numbers are valid) { if(largest_variable less than current_value) largest_variable equals current_value; /* similar approach for smallest value */ } HTH