noooooo i failed :'(
it sucks to be me right now i hate programming
Right now we're doing loops and I have to make 2 little tiny mini programs. I don't know what code to right for the first program or the second program. First program is basically when you enter a 2 or more digit number like 463, the output displays the digits on different lines). Example...
4
6
3
This all is supposed to be done using do while and while.
Second program is it starts with 2 numbers and the program keeps on adding up the sum of the numbers and only saving the one's digit. Some programmers might refer to this as "the necklace program."
noooooo i failed :'(
it sucks to be me right now i hate programming
Last edited by Orteez; 10-27-2010 at 07:00 PM.
Hmm, Why don't you try finding a guide online and also wrong section.
I posted the program before the database reset, you should have checked /
Anyway, if it helps it was something like this (it's a quick rewrite, check for any errors):
[php]#include <iostream>
using namespace std;
int main() {
string x = ""; // our number, as a string
int i = 0; // used to count
cin >> x; // input number
while(i < x.length()) { // cycle through the characters
cout << x[i] << endl; // output characters
i++; // make sure we actually move forwards every time we print out a character
}
}
[/php]
As for the necklace it was similar but with an infinite loop and the modulus operator (with 10).
I'm Alen on Steam. RIP Skype Friday nights.
I'm Navi's lover 💖
Dave84311: God I've always wanted to eat crayons, with their vibrant colors. Only if they had taste.
Mr. Lonely: @Alen I like making you wet, it makes me hard.