Here is a simple program that will tell you how to make an algorithm:
int main();
{
int length;
int width;
int total;
printf("What is the width: ");
scanf("%d", &width);
printf("What is the length: ");
scanf("%d", &length);
total = width * 2 + 2 * length; /*Here is the algorithm for finding the perimeter of a square*/
printf("The perimeter is: %d", total);
return 0;
}
Output:
What is the width: 32
What is the length: 55
The perimeter is: 174
C Programming language is already defined, you don't have to do anything with it.
You could write a C-compiler, if your were much more experienced than you are now.
Or you can write a program in C, I give you an example:
#include
int main (void)
{ puts ("Hello, world!"); return 0; }
An algorithm is simply a description of the logical step-by-step procedure required to solve a particular problem. You do not write algorithms in C (or indeed in any programming language) you write them in your native language (such as English). Algorithms that employ loops or conditional expressions are typically presented using a flowchart to better visualise the implementation of complex algorithms, however all complex problems can be broken down into a sequence of much simpler problems each of which has its own algorithm. When presenting algorithms to programmers from various backgrounds, pseudo-code is used to provide a language-agnostic version of the implementation that can easily be translated into any language but, ultimately, it is the programmer's responsibility to translate algorithms into functional code. But first you have to write the algorithm. Ignore the language and concentrate on the problem itself. Describe how the problem should be solved, then write the code to implement your solution.
No-one can answer a question like that here!
For a start you've not told us what you want the programme to do: complex word-processing, heavy mathematics, process-control, high-speed graphics...?
The most anyone could do here is answer specific queries about particular commands, routines or errors that have baffled you.
Even introductory books on C++, or any other language, are hefty tomes.
You can only learn effective computer programming on a formal course, unless your aptitude and previous experience is sufficient to allow you to pick it up from a text-book, worked examples and a heck of a lot of practice.
printf ("x")
You can write a C++ fib pro using arrays but the problem is the prog becomes very complicated since u need to pass the next adding value in an array.....
how to write a program that counts automorphic number from 1 to 999
Don't write, it is already written, google for 'cpp'.
Divide it by 1000.
printf ("x")
To swap two variables without using a third variable, use exclusive or manipulation... a ^= b; b ^= a; a ^= b;
You can write a C++ fib pro using arrays but the problem is the prog becomes very complicated since u need to pass the next adding value in an array.....
I don't think its possible. Every C++ program must at least have the main function.
how to write a program that counts automorphic number from 1 to 999
Functions are very important in C++, as you can't write the simplest program to print hello without using a function. Overall you can say that function are building blocks of a C++ program. Functions can also be defined by the programmer to reduce program size.
By learning how to program on C+.
Don't write, it is already written, google for 'cpp'.
Divide it by 1000.
No.
C++ is used to write programs, not to design computers. If you want to design computers, use a CAD program specifically intended to aid in electronics design.
You don't write an algorithm for a C++ program, unless you are documenting the C++ program after-the-fact. The normal procedure is to write the algorithm first, in a language independent fashion, and then translate that stated algorithm into C++ code, or into whatever language you wish.