Thank you it works
i understand it now
done it and it works...
User Profile
Collapse
-
-
fibonci series and recursive function
i was looking for questions on while loops when i came across a problem that said write a program that displays fibonacci numbers
and the code that i wrote works just fine
Code:int x1=1; int x2=1; int x3; int x; cout<<"please enter the number "<<endl; cin>>x; cout<<x1<<endl<<x2<<endl; while (x2<x) {
-
first of all when you write a function as void it will return nothing but it can process reading and when you write a function using void it is usually pass by reference
and when you need to return something you are actulaay using pass by referenceLeave a comment:
-
hapa started a topic Help needed on writing c++program takes a jpeg file name location& output it on HTMLin CHelp needed on writing c++program takes a jpeg file name location& output it on HTML
I want to write a program that take a name of a person and also a name of a jpeg file with known destination and create an output on an HTML format but it should also display the picture help me out it is easy to take in name using CIN and Output file can be created usuing ofstream but the problem is how can i output a picture. can some body help me out -
Need help understanding more about masking
how can i use bitwise masking in C++
please explain -
If only there was a code the instructors wouldnt give us this question to write a program to convert an integer into binary
we are suppose to write a program that uses loops
read my thread i have similar program to write may be that might help its title is converting decimal into binary
but it prints the binary in LSB while we require MSBLeave a comment:
-
[QUOTE=Fir3Bat]I have been using file io for like a week now, not an expert but this is for my computer science class.
Say the file is 71cIN.txt and inside the file it said "What a beautiful day to be programming."
And what i have to do is display all the words, and count all the letter 'e's in the sentence.
this is wat i have so far
Code:#include <iostream> #include
Leave a comment:
-
for instance
string s1;
getline(fin,s1)
cout<<s1<<endl;
it stores the whole line in the s1Leave a comment:
-
Why dont you use the getline function it will read the whole line and you can store it is a string and cout the outputLeave a comment:
-
Why dont you count number of { braces
than count }
you will know where you have missed
and in your second code mean you have an extra } brace
you might want to delete it or you will need to type { brace before in your program since you are using it for a blockLeave a comment:
-
-
void sidetype(int a, int b, int c)
{
if(a==b==c)
cout<<"Equilate ral Traingle\n";
if(a==b || c==a || b==c)
cout<<"Isoscele s Traingle\n";
else cout<<"Scalene Triangle\n";
}
void sortsides(int&a , int&b, int&c)
{ if (a>b)
swap(a, b);
if (b>c)
swap(b, c);
if (a>b)...Leave a comment:
-
hapa started a topic help need for writing an algorthim for a program that reads to file and compares themin Chelp need for writing an algorthim for a program that reads to file and compares them
I am suppose to write a C++ program that reads two C++ program and compares both of them and outputs wether they are copied or not.
But the problem is i dont know where to start from that is i have no lead on the algorthim
one possible solution that came to my mind is that first i will have to use while END of file loop
and read each character one by one from the two program and compare them
however the problem... -
i can write the program for you but you will learn more if you write it own your own it helps a lot and clear a lot of doubts and also it makes you learn the types of error or mistakes that you have done
its 6:12 AM here
i have to go to university at 8:00AM and i havent taken a nap so forgive me if i wasnt a help you can mail me if you want to with your doubt in this question byeLeave a comment:
-
once this work you can write add the
//priming
..........
while(cin !=0)
{
//priming
............
}
in the end once you do it it will be easy to add this and this thing makes your program get many data from the users unless he enters 0
you can mail me you program too if you want me to look at it
my e- mail is
xxx@xxx.com (E-mail removed...Leave a comment:
-
close your for statement where you close our while statement and also since you are not getting any result something is wrong with your equation
i will tell you one good trick
write the program again but this time only and only consider that you are finding the value of one sine for instance only with degree 30 only
since now you know how to do priming that you can do it in the end to enter multiple data until user...Leave a comment:
-
the reason is because you are closing your
FOR statement before that means by the time the factorial comes out of the loop it is already 15
but remember you are suppose to use each factorial like 3! should be 1*2*3
4!=1*2*3*4
but your for statement makes factorial already 15 before using it
and also dont make guesses use debugger to find the mistake that you are making in your program what goes wrong where...Leave a comment:
-
tell me one thing when you compile this code of yours and run it without debugging
do you get a runtime error
because no where have you defined factorails value it is undefinedLeave a comment:
-
in the question that you have posted you are required to use to while statement
one you have used but the other one that requires you to use priming
cin>>x
while(cin !=0)
{
cin>>x
}
the underline must be same always what statement you write before while should be the same that you write before ending that whileLeave a comment:
No activity results to display
Show More
Leave a comment: