- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 4
- Posts with Downvotes
- 2
- Downvoting Members
- 4
16 Posted Topics
[CODE]#include <iostream> using namespace std; int main() { int i; char ch; cout<<"Number "; cin>>i; cout<<"Letter:"; cin>>ch; for(int j = 0 ; j < i; j++) { cout<<ch<<"\n"; } return 0; } [/CODE]
hello,i must solve this problem : "Sum all even digits of a given number. That's what i've got so far. [CODE] #include <iostream> using namespace std; int main() { int sum = 0 , num; cin>>num; while(num > 0) { sum+=num%10; num/=10; } cout<<sum; return 0; } [/CODE] the problem …
[CODE] #include <iostream> #include <algorithm> int main() { int array[] = { 23, 5, -10, 0, 0, 321, 1, 2, 99, 30 }; int elements = sizeof(array) / sizeof(array[0]); std::sort(array, array + elements); for (int i = 0; i < elements; ++i) std::cout << array[i] << ' '; }[B][/B][/CODE] use …
[CODE]#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef std::vector<int>vInts; int main() { vInts v; int user_input; for( int i = 0; i < 5; i++ ) { cout << "Enter a number: "; cin >> user_input; v.push_back( user_input ); } sort( v.begin(), v.end() ); cout << "The largest …
hello, I have a problem.I want to search by color , gender (these are the options) in a text file (called text.txt). My text file looks like that. How can i do that?) ex. cin>>s , then find for "s" , if found cout all data about him (gender , …
hello , whet i compile , i get these errors , but i dont know where i mistaked g++ -Wall -o "untitled" "untitled.cpp" (in directory: /home/btwnix/Documents/Projects) untitled.cpp: In function ‘std::string bunnynames(std::string)’: untitled.cpp:14:14: error: no matching function for call to ‘tolower(std::string&)’ untitled.cpp:14:14: note: candidates are: /usr/include/ctype.h:116:12: note: int tolower(int) /usr/include/ctype.h:116:12: note: …
Hello. I trying to solve this problem. The user inputs 4 numbers to each array (they are 2). I must output the common elements. So this is the problem i'm stucking with . Let's say p = 1,2,2,3 p1 = 3,5,1,2 the output is 2 1 3 1 2 but …
hello , let me know , what is the best way to learn c++ efficiently , reading c++ books and doing exercises based on the each capter , or read a book , then to solve exercises?. I'm waiting a reply from those experienced people . Thanks.
I'm trying to solve this exercise. Write a program that print out the following, user will input the top number: ***** **** *** ** * i made a program similary to this , but user inputs the bottom number ,the output is like this: * ** *** **** ***** here …
hello , i want to cin n numbers then to sort the positive numbers in one array, the negative numbers in another array , then to print positive array. So let me explain , i run the program , i enter the 9 , then enter 1 2 3 4 …
hey bro' , I made your program in one function . Separate it in needed functions) [CODE] #include <cstdlib> #include <iostream> #include <conio.h> #include <string> using namespace std; int main(int monNumber) { string mon[] = {"JAN" ,"FEB", "MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"}; cout<<"enter a number between 1-12 :"; cin>>monNumber; if(monNumber>0 && monNumber<13) { cout<<mon[monNumber-1]; …
hello , i'm trying to solve this problem [QUOTE]Create a program which generates fibonacci series till a number 'n' where 'n' is entered by the user. For eg. if the user enters 10 then the output would be: 1 1 2 3 5 8 (beginner)[/QUOTE] the problem is that the …
[CODE]#include<iostream> using namespace std; int main() { int num,factorial(int n) ; cout<<"Enter a number "<<endl; cin>>num; } //your main function ends here , but it must end at the end of the code <<<<<-- for(n=0;n<100;n++) { cout<<""<<n<<endl; system("pause"); }[/CODE]
hello , i made a election program , here it is [CODE]#include <iostream> #include <cstdlib> #include <string> #include <conio.h> #include <iomanip> #include <fstream> using std::ofstream; using namespace std; string users[4]; char choice2; int votes[100] = {0}; int choice; int totalVotes=0; void votes1() { cout<<"Voting! : "<<endl; cout<<setw(21)<<left<<"(1) To vote " …
Hello all , i have a small problem , i'm writing now a voting program , and i'm a little bit confused , how can i attribute the votes to a certain person? i mean , i enter the value 1 , and this vote must go to the first …
The End.