c++ assignment need help with

Computer Science
Tutor: None Selected Time limit: 1 Day

i need help in my c++ class

Oct 3rd, 2015

Thank you for the opportunity to help you with your question!

I can help you.          .............................................................                                                                              

Please let me know if you need any clarification. I'm always happy to answer your questions.
Sep 20th, 2015

okay it's an assignment need it done asap if u can, this is the details 


Write computer programs to solve the following problems. Make sure you follow all instructions.


1- Write a program to display the following output using a single output statement.

Subject                   Grade

Mathematics           90

Computer Pgrm       75

Chemistry               80


2- Write a program that adds 2 predefined numbers and outputs the result (including the operation).

Then collect input (numbers) from the user and perform the same operation and output the corresponding result.


3- Write a program that uses 3 variables only. Collects 2 inputs (numbers) from the user into 2 variables, then swaps the value of the two variables.

Display the operation in the console output window in the following manner:

The values entered are: Variable1 = 48     Variable2 = 5

The swapped values are: Variable1 = 5     Variable2 = 48


(Bonus) zWhen you are done, see if you can swap the values without using the third variable (Optional). 


4- Write a program that collects the radius of a circle from the user, then calculate and displays periimeter and area of the circle.


5- Write a program that perfoms the followin operations. Make sure to replace the variable x and y with more meaniful variable identifiers line var1 and var 2, or xvar and y var, or variableX and variableY.

Display the operations on the screen along with an output statement for each statement of code explaining what happened and the resulting values of each variable after each statement. Also add comments to your code as you write it for each statement (points will be substracted if no comment is provided for each line or statement in your code).


int x = 10, y;

y = x   +   7%2;

cout << y;

y = 5   +   x++;

cout << y;

y = ++x   +   10;

cout << y;

x = 10;

cout << ++x;

cout << x++;

x = 10;

y = x   +   x++;

cout << y;

cout << x;

y = ++x   +   x++   +   x;

cout << y;

cout << x;

y = x++   +   x;

cout << y;

cout << x;

y = x   +   ++x;

cout << y;

cout << x;


Sep 20th, 2015

Hey! they are too many questions. how much will you pay?

Sep 20th, 2015

its depend in your work but my budget is from $5 to $15

Sep 20th, 2015

How much time we have?

Sep 20th, 2015

5 TO 10 hrs

Sep 20th, 2015

//1.

#include<iostream.h>

using namespace std;

int main()

{

cout<<"Subject\t\tGrade"<<endl;

cout<<"Mathematics\t90"<<endl;

cout<<"Computer Pgrm\t75"<<endl;

cout<<"Chemistry\t80"<<endl;

return 0;

}

//2.

#include<iostream.h>

using namespace std;

int main()

{

int a=3, b=5;

int c=a+b;

cout<<a <<" + "<<b<<" = "<<c<<endl;

return 0;

}

//Now to add taking two numbers from users

#include<iostream.h>

using namespace std;

int main()

{

int a, b;

cout<<"Enter 1st number :";

cin>>a;

cout<<"Enter 2nd number:";

cin>>b;

int c=a+b;

cout<<a <<" + "<<b<<" = "<<c<<endl;

return 0;

}

//3.

#include<iostream.h>

using namespace std;

int main()

{

int a, b;

cout<<"Enter Variable1 :";

cin>>a;

cout<<"Enter Variable2 :";

cin>>b;

cout<<"The values entered are: Variable1 = "<<a<<" Variable2 = "<<b<<endl;

int c;

c=b;

b=a;

a=c;

cout<<"The swapped values are: Variable1 = "<<a<<" Variable2 = "<<b<<endl;

return 0;

}

//Swapping of variable using only two variables

#include<iostream.h>

using namespace std;

int main()

{

int a, b;

cout<<"Enter Variable1 :";

cin>>a;

cout<<"Enter Variable2 :";

cin>>b;

cout<<"The values entered are: Variable1 = "<<a<<" Variable2 = "<<b<<endl;

b=a;

a=b;

cout<<"The swapped values are: Variable1 = "<<a<<" Variable2 = "<<b<<endl;

return 0;

}

//Here both the number takes same value. Hence it is not possible to swap without third number

//4.

#include<iostream.h>

using namespace std;

int main()

{

float radius;

cout<<"Enter radius of circle : ";

cin>>radius;

float perimeter=2*3.14*radius;

float area=3.14*radius*radius;

cout<<"Perimeter of circle = "<<perimeter<<endl;

cout<<"Area of circle = "<<area<<endl;

return 0;

}


Sep 20th, 2015

//5.

#include<iostream.h>

using namespace std;

int main()

{

int var1 = 10, var2;

//This is the 1st step of initialisation of variables

cout<<"Initialisation: "<<endl;

cout<<"Value of var1 = "<<var1<<"  Value of var2 = "<<var2<<endl;

var2 = var1   +   7%2;

//Here var2 is given value of var1 + remainder when 7 is divided by 2

cout<<"\nOperation performed:  var2 = var1   +   7%2 "<<endl;

cout<<"Value of var1 = "<<var1<<"  Value of var2 = "<<var2<<endl;

var2 = 5   +   var1++;

//Here var1 is given value of 5 + value of var1, also value of var1 is post incremented

cout<<"\nOperation performed:  var2 = 5   +   var1++  "<<endl;

cout<<"Value of var1 = "<<var1<<"  Value of var2 = "<<var2<<endl;

var2 = ++var1   +   10;

//Here var1 is given value of pre-incrementing value of var1 +10

cout<<"\nOperation performed:  var2 = ++var1 + 10   "<<endl;

cout<<"Value of var1 = "<<var1<<"  Value of var2 = "<<var2<<endl;

var1 = 10;

//Here value of var1 is reassigned to 10

cout<<"\nOperation performed:  var1=10  "<<endl;

cout<<"Value of var1 = "<<var1<<"  Value of var2 = "<<var2<<endl;

cout<<"\nPre-increment the value  of var1"<<endl;

cout<<"Var1 = ";

cout << ++var1<<endl;

//Here value of var1 is shown pre-incrementing

cout<<"\nPost-increment the value  of var1"<<endl;

cout<<"Var1 = ";

cout << var1++<<endl;

//Here value of var1 is shown post-incrementing, so previous value of variable is displayed then vallue is incremented

var1 = 10;

//Here value of var1 is reassigned to 10

cout<<"\nOperation performed:  var1=10  "<<endl;

cout<<"Value of var1 = "<<var1<<"  Value of var2 = "<<var2<<endl;

var2 = var1   +   var1++;

//Here val2 is given value var1 + adding post increment value of var1. 

cout<<"\nOperation performed:  var2 = var1   +   var1++"<<endl;

cout<<"Value of var1 = "<<var1<<"  Value of var2 = "<<var2<<endl;

var2 = ++var1   +   var1++   +   var1;

//Here var2 is given value pre increment value of var1 +post increment value of var1 + value of var1

cout<<"\nOperation performed:  var2 = ++var1   +   var1++   +   var1 "<<endl;

cout<<"Value of var1 = "<<var1<<"  Value of var2 = "<<var2<<endl;

var2 = var1++   +   var1;

//Here val2 is given post increment value of var1 + value var1 .

cout<<"\nOperation performed:  var2 = var1++   +   var1 "<<endl;

cout<<"Value of var1 = "<<var1<<"  Value of var2 = "<<var2<<endl;

var2 = var1   +   ++var1;

//Here val2 is given value var1 + adding pre increment value of var1.

cout<<"\nOperation performed:  var2 = var1   +   ++var1"<<endl;

cout<<"Value of var1 = "<<var1<<"  Value of var2 = "<<var2<<endl;

return 0;

}


Sep 20th, 2015

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
...
Oct 3rd, 2015
...
Oct 3rd, 2015
Dec 3rd, 2016
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer