Hi, im new to c++ and wondered if anyone could help me with this

Use a for loop to display 3 times table backwards

12 times 3 = 36
11 times 3 = 33
10 times 3 = 30
9 times 3 = 27
8 times 3 = 24
7 times 3 = 21
6 times 3 = 18
5 times 3 = 15
4 times 3 = 12
3 times 3 = 9
2 times 3 = 6
1 times 3 = 3

7
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by Kev06N

Make a for loop that starts from 12 to 1 (Decrementing here )
and then multiply 3 by the index and cout the result.

``````#include<iostream.h>

main(){
for(int index = 12; index >= 1; i--){
}
}``````

Iwish that hels you GOOD LUCKk:D

Don't people test their code anymore?
A few good advices: First learn English, then you should read the forum rules (you'll understand them, because you know English), then learn how to write good C++ code and after that maybe posting using code tags would be helpful as well!
``````#include<iostream.h>

main(){
for(int index = 12; index >= 1; i--){
}
}
``````

I wish that helps you GOOD LUCK :D

-iostream.h should be iostream
-it's int main
-you're mixing index with the variable i

Edited by Reverend Jim: Fixed formatting

Agreed :)

Hi, im new to c++ and wondered if anyone could help me with this

Use a for loop to display 3 times table backwards

12 times 3 = 36
11 times 3 = 33
10 times 3 = 30
9 times 3 = 27
8 times 3 = 24
7 times 3 = 21
6 times 3 = 18
5 times 3 = 15
4 times 3 = 12
3 times 3 = 9
2 times 3 = 6
1 times 3 = 3

``````#include<iostream.h>

main(){
int multiply;
// for loop for 12 times
for(int count = 12;count >=  ;count--){
multiply = 3*count;
cout << count << "  times 3 = " <<multiply << endl;
}//for

return 0;
}``````

I hope you enjoy it.

Keep it simple:

``````for (int i = 12; i; i--)
cout << i << " times 3 = " << 3*i << '\n';``````

;)

Here it goes..... text file attached!

Attachments
``````void editRec(cust customers[], int &row)
{
clrscr();

int entry;
int cuno = 0;
char yeno;
boolean found = false;
cout << "Enter Customer Number to Edit : " ;
Input(cuno);

for ( int i=0;i<row;i++ )
{
if (cuno == customers[i].custno)
{
boolean found = true;
cout << "Record Found:\n"
<<"1 Cust No  :"<<customers[i].custno <<endl
<<"2 Cust Name:"<<customers[i].name << endl
<<"3 Street   :"<<customers[i].street << endl
<<"4 Town     :"<<customers[i].town << endl
<<"5 Postcode :"<<customers[i].postcode << endl
<<"6 Area Code:"<<customers[i].phone << endl
<<"7 Phone No :"<<customers[i].number << endl
<<"8 Total    :"<<customers[i].totsale << endl
<<"9 Credit   :"<<customers[i].credlim <<endl
<<"0 Balance  :"<<customers[i].curbal <<endl
<<"\nAre you sure you want to edit this record?"<<endl;
Input(yeno);

if(yeno =='y'||yeno == 'Y')
{

cout << "\n\nEnter line number of record to be Edited:";
cin >> entry;
switch (entry)
{
case 1:   clrscr();
do
{
cout << "Please Enter Customer Number   : ";
Input (customers[i].custno);
}
while(customers[i].custno < 0 || customers[i].custno > 500);
break;
case 2:  clrscr();
cout << "\n\nPlease Enter Customers Name   : ";
Input (customers[i].name,31);
break;
case 3: clrscr();
cout << "\n\nPlease Enter Customers Street   : ";
Input (customers[i].street,26);
break;
case 4:  clrscr();
cout << "\n\nPlease Enter Customers Town   : ";
Input (customers[i].town,17);
break;
case 5:  clrscr();
cout << "\n\nPlease Enter Customers Postcode   : ";
Input (customers[i].postcode,9);
break;
case 6:	clrscr();
cout << "\n\nPlease Enter Customers Phone code  : ";
Input (customers[i].phone,6);
break;
case 7:	clrscr();
cout << "\n\nPlease Enter Customers Phone Number  : ";
Input (customers[i].number,7);
break;
case 8:	clrscr();
cout << "\n\nPlease Enter Customers Total Sales ex VAT : ";
Input (customers[i].totsale);
break;
case 9:	do
{
clrscr();
cout << "\n\nPlease Enter Customers Credit Limit  : ";
Input (customers[i].credlim);
}
while (customers[i].credlim < 0.00 || customers[i].credlim > 9999.99);
break;
case 0:	clrscr();
cout << "\n\nPlease Enter Customers Current Balance  : ";
Input (customers[i].curbal);
break;
default: clrscr();
cout << "Invalid option\n";
pressKey();
break;
}
cout << "\nRecord Updated returning to main menu";
pressKey();

}
else
{