FOR Cycle in codeblocks

Hello people! My name's Mike, and i'm at a math-info / english intensive profile class. Got some homework to do, i'm already behind the schedule w/ 2 days and my teacher's already mad at me. I'd be glad if some of you could help me out with these, cus i'm totally lost. Here are the exercises( Im not asking you to do my homework, i just need help):
1. Make a programm, that writes out the N-multiplication table.
Example: n=6 ; 1x6=6 ; 2x6=12 ...
2.Given a N natural product. Determine all a,b natural numbercouples(yeah, this is what google translate gave me to "szamparos"), which a*a + b*b = n
(power)
I'm seriously lost at these, help please, and if you could explain the cycle itself and what is every command in it for i'd be glad!:D



1
2
3
4
#include<iostream>
using namespace std;

int main()
Start with the first part, one step at a time.
1. You apparently have to read the N from the user. Do so.
2. A simple for-loop can iterate over range of values (e.g. 1..10). Each iteration can print one line of the table.

If you don't know any of those, then you will look them up from your class notes and/or from the tutorials on this website.

You have not put much effort on your code so far, but even that can be improved and learned from:
1
2
3
4
5
#include <iostream>

int main () {
  using std::cin;
  using std::cout;

A websearch should give you plenty of explanations, why one should avoid using namespace std;.
Topic archived. No new replies allowed.