First Program Help
This is my first attempt at C++ programming, only done a bit in Small. I want to create a program that finds the pair for a DNA sequence on the molecule. So if the Input string is CTTAG, all C's would be replacesd with T's, all G's with A's and vice versa. The output woud be TCCGA. So basically it reads the string, replaces the letters, and prints it back, for any length string.
Any help, or pointers in the right direction? I am really quite a newbie. Thanks
Just start coding. You got the algorithm down already. Post code when you have any problem.
I hope "This is my first attempt at C++" does not mean that this is your first program. If so, start reading tutorial on this site.
Welcome and good luck!
If you wanted to get advanced, you could use string.h functions, but a more novice way would be to input a string using getline() and pick out specific characters with a for loop and if statements.
like alphaoide said, just jump in. make a mess of your code and when you get confused come back with what you have. a suggestion I have is to use C-style strings and use the strlen() function found in <cstring>. ignore what UnderGod said... the way I would do it is to do this:
1) take in teh string (getline())
2) loop through the string, character by character (strlen(),for(),char arrays)
3) use if statements to compare each character
4) replace the character if necessary
5) output the string again
Ok, Ill try that but it nearly is my first attempt at coding, the things I made were quite pitiful. Anyway I'll try.