I need a person can help me in c++because i am novice | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I need a person can help me in c++because i am novice

14th Dec 2017, 9:03 PM
zahra
zahra - avatar
11 Answers
+ 4
yes i do this way
15th Dec 2017, 6:35 AM
zahra
zahra - avatar
+ 2
tnx u
14th Dec 2017, 10:12 PM
zahra
zahra - avatar
+ 1
i am newrly coding so i have problem in some program although they are simple
14th Dec 2017, 9:11 PM
zahra
zahra - avatar
+ 1
like this
14th Dec 2017, 9:13 PM
zahra
zahra - avatar
+ 1
#include<iostream> #include<math.h> using namespace std; int f(int ); int main() { int i,fact ; cout « "please enter an integer number= "; cin » i; f; return 0; } int f(int) { int i,fact ; if ( i != 0) { return (i* fact (i - 1)); } return 1; }
14th Dec 2017, 9:13 PM
zahra
zahra - avatar
+ 1
or
14th Dec 2017, 9:13 PM
zahra
zahra - avatar
+ 1
#include<iostream> using namespace std; int main() { char c; if (c != 'e') { cout « "enere a char="; cin » c; cout « "enter e for exit="; } return 0; }
14th Dec 2017, 9:13 PM
zahra
zahra - avatar
+ 1
Your first program should look like this: #include<iostream> using namespace std; int f(int i); int main() { int i; cout << "please enter an integer number= "; cin >> i; cout << f(i) << endl; return 0; } int f(int i) { if (i != 0) { return (i * f(i - 1)); } return 1; } You could also change the 4 f to fact, which makes more sense (you had one that way.)
14th Dec 2017, 11:17 PM
John Wells
John Wells - avatar
+ 1
I think others will make me mock because others know very well
15th Dec 2017, 6:15 AM
zahra
zahra - avatar
0
The last code doesnt make sense to me... it would be better for enter anything to exit. Like this int main(){ int c; cout << "Press anything to exit..."; cin >> c; if (c==" ") { return 0; } else { return 0; } }
14th Dec 2017, 10:10 PM
Ice
Ice - avatar
0
You might run into a few, but most have been where you are and will go out of their way to help.
15th Dec 2017, 6:18 AM
John Wells
John Wells - avatar