#include"iostream"
void main(){
for(int x = 0; x < 5; x++){
for(int y = 0; y < x; y++){
std::cout<<"*";
}
std::cout<<"\n";
for(int y = (x - 1); y < 5; y++){
std::cout<<" ";
}
for(int y = 0; y < x; y++){
std::cout<<"*";
}
}
for(int y = 0; y < 5; y++){
std::cout<<"*";
}
std::cout<<"\n";
system("PAUSE");
}
void main(){
for(int x = 0; x < 5; x++){
for(int y = 0; y < x; y++){
std::cout<<"*";
}
std::cout<<"\n";
for(int y = (x - 1); y < 5; y++){
std::cout<<" ";
}
for(int y = 0; y < x; y++){
std::cout<<"*";
}
}
for(int y = 0; y < 5; y++){
std::cout<<"*";
}
std::cout<<"\n";
system("PAUSE");
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include"iostream"
int ArrayX[5];
int ArrayY[5];
int ArrayAdded[5];
void Adder();
void main(){
std::cout<<"Enter values for the first array: "<<std::endl;
for(int x = 0; x < 5; x++){
std::cout<<"Enter the "<< (x+1) <<": ";
std::cin >>ArrayX[x];
}
std::cout<<"\nEnter values for the second array: "<<std::endl;
for(int x = 0; x < 5; x++){
std::cout<<"Enter the "<< (x+1) <<": ";
std::cin >>ArrayY[x];
}
Adder();
system("PAUSE");
}
//the only needed answer
void Adder(){
std::cout<<"\nNow Adding"<<std::endl;
for(int x = 0; x < 5; x++){
ArrayAdded[x] = ArrayX[x] * ArrayY[x];
}
std::cout<<"\nDone Adding"<<std::endl;
std::cout<<"\nAdded result."<<std::endl;
for(int x = 0; x < 5; x++){
std::cout<<ArrayAdded[x]<<"\t";
}
std::cout<<"\n";
}
int ArrayX[5];
int ArrayY[5];
int ArrayAdded[5];
void Adder();
void main(){
std::cout<<"Enter values for the first array: "<<std::endl;
for(int x = 0; x < 5; x++){
std::cout<<"Enter the "<< (x+1) <<": ";
std::cin >>ArrayX[x];
}
std::cout<<"\nEnter values for the second array: "<<std::endl;
for(int x = 0; x < 5; x++){
std::cout<<"Enter the "<< (x+1) <<": ";
std::cin >>ArrayY[x];
}
Adder();
system("PAUSE");
}
//the only needed answer
void Adder(){
std::cout<<"\nNow Adding"<<std::endl;
for(int x = 0; x < 5; x++){
ArrayAdded[x] = ArrayX[x] * ArrayY[x];
}
std::cout<<"\nDone Adding"<<std::endl;
std::cout<<"\nAdded result."<<std::endl;
for(int x = 0; x < 5; x++){
std::cout<<ArrayAdded[x]<<"\t";
}
std::cout<<"\n";
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include"iostream"
int sq;
int cu;
int SumSq;//sum of square
int SumCu; //sum of cubes
int Gcu; //cubes greater than 500
void main(){
std::cout<<"\tNumbers\tSquare\tCube"<<std::endl;
for(int x = 0; x < 16; x++){
sq = x * x;
cu = x * x * x;
SumSq += sq;//sum of the square
SumCu += cu;//sum of the cube
if(cu > 500){
Gcu++;
}
std::cout<<"\t"<<x<<"\t"<<sq<<"\t"<<cu<<"\t"<<std::endl;
}
std::cout<<"The sum of the square: "<<SumSq<<std::endl;
std::cout<<"The sum of the cubes: "<<SumCu<<std::endl;
std::cout<<"Cubes greater than 500: "<<Gcu<<std::endl;
system("PAUSE");
}
int sq;
int cu;
int SumSq;//sum of square
int SumCu; //sum of cubes
int Gcu; //cubes greater than 500
void main(){
std::cout<<"\tNumbers\tSquare\tCube"<<std::endl;
for(int x = 0; x < 16; x++){
sq = x * x;
cu = x * x * x;
SumSq += sq;//sum of the square
SumCu += cu;//sum of the cube
if(cu > 500){
Gcu++;
}
std::cout<<"\t"<<x<<"\t"<<sq<<"\t"<<cu<<"\t"<<std::endl;
}
std::cout<<"The sum of the square: "<<SumSq<<std::endl;
std::cout<<"The sum of the cubes: "<<SumCu<<std::endl;
std::cout<<"Cubes greater than 500: "<<Gcu<<std::endl;
system("PAUSE");
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include"iostream"
void table(int s[5][5]);
int intArray[5][5];
void main(){
table(intArray);//call the array
system("PAUSE");//hold the system from crasching
}
void table(int r[5][5]){
//Accept array inputs
for(int x = 0; x < 5; x++){
for(int y = 0; y < 5; y++){
std::cout<<"Enter a number: ";//request for input
std::cin>>r[x][y];//save the input
}
}
//display array
std::cout<<"\n\n"<<std::endl;
for(int x = 0; x < 5; x++){
for(int y = 0; y < 5; y++){
std::cout<<r[x][y]<<"\t";//display and tablet
}
std::cout<<"\n";//creates new line
}
}
void table(int s[5][5]);
int intArray[5][5];
void main(){
table(intArray);//call the array
system("PAUSE");//hold the system from crasching
}
void table(int r[5][5]){
//Accept array inputs
for(int x = 0; x < 5; x++){
for(int y = 0; y < 5; y++){
std::cout<<"Enter a number: ";//request for input
std::cin>>r[x][y];//save the input
}
}
//display array
std::cout<<"\n\n"<<std::endl;
for(int x = 0; x < 5; x++){
for(int y = 0; y < 5; y++){
std::cout<<r[x][y]<<"\t";//display and tablet
}
std::cout<<"\n";//creates new line
}
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include"iostream"
void main(){
for(int x = 1; x < 6; x++){
std::cout<<"\n";
for(int y = x; y < 6; y++){
std::cout<<y;
}
}
std::cout<<"\n";
for(int x = 1; x < 7; x++){
std::cout<<"\n";
for(int y = x; y < 7; y++){
std::cout<<"*";
}
}
std::cout<<"\n";
system("PAUSE");
}
void main(){
for(int x = 1; x < 6; x++){
std::cout<<"\n";
for(int y = x; y < 6; y++){
std::cout<<y;
}
}
std::cout<<"\n";
for(int x = 1; x < 7; x++){
std::cout<<"\n";
for(int y = x; y < 7; y++){
std::cout<<"*";
}
}
std::cout<<"\n";
system("PAUSE");
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include"iostream"
void main(){
for(int x = 1; x < 6; x++){
std::cout<<"\n";
for(int y = 0; y < x; y++){
std::cout<<" ";
}
for(int y = x; y < 6; y++){
std::cout<<y;
}
}
std::cout<<"\n";
system("PAUSE");
}
void main(){
for(int x = 1; x < 6; x++){
std::cout<<"\n";
for(int y = 0; y < x; y++){
std::cout<<" ";
}
for(int y = x; y < 6; y++){
std::cout<<y;
}
}
std::cout<<"\n";
system("PAUSE");
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include"iostream"
void main(){
for(int x = 1; x < 7; x++){
std::cout<<"\n";
for(int y = 0; y < x; y++){
std::cout<<"*";
}
for(int y = (x - 1); y < 7; y++){
std::cout<<" ";
}
}
std::cout<<"\n";
system("PAUSE");
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void main(){
for(int x = 1; x < 7; x++){
std::cout<<"\n";
for(int y = 0; y < x; y++){
std::cout<<"*";
}
for(int y = (x - 1); y < 7; y++){
std::cout<<" ";
}
}
std::cout<<"\n";
system("PAUSE");
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include"iostream"
void main(){
for(int x = 1; x < 7; x++){
std::cout<<"\n";
for(int y = 7; y > x; y--){
std::cout<<"*";
}
for(int y = (x + 1); y > 7; y--){
std::cout<<" ";
}
std::cout<<"\n";
for(int y = 0; y < x; y++){
std::cout<<"*";
}
for(int y = (x - 1); y < 7; y++){
std::cout<<" ";
}
}
std::cout<<"\n";
system("PAUSE");
}
void main(){
for(int x = 1; x < 7; x++){
std::cout<<"\n";
for(int y = 7; y > x; y--){
std::cout<<"*";
}
for(int y = (x + 1); y > 7; y--){
std::cout<<" ";
}
std::cout<<"\n";
for(int y = 0; y < x; y++){
std::cout<<"*";
}
for(int y = (x - 1); y < 7; y++){
std::cout<<" ";
}
}
std::cout<<"\n";
system("PAUSE");
}







No comments:
Post a Comment