VUsolutions Transferred to AchiKhasi.com

From December 2011, this blog www.VUsolutions.blogspot.com is transferred to http://achikhasi.com/vu/ . So, you may visit http://achikhasi.com/vu/ for latest study related help.

Back to home VUsolutions

VUsolutions Fans Club [join us for MORE solutions]

VUsolutions on Facebook

CS410 Assignment 1 Solution Fall 2012

Tuesday, November 06, 2012 Edit This

use Dev C++ and create a new c++ project

create an integer type array of 5 elements

create an char type array of 5 elements

create a pointer of type integer and copy the values of integer array to this pointer one be one and increment the pointer 
then copy the char array's values in the pointer of type integer 
print the specified output and give some explanation about the above.

For syntax visit C++ tutorial site
....................................
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int *x[5];
int a[5] = {1,2,3,4,5};
char b[5] = {'a','b','c','d','e'};
int i;


for (i=0; i<5; i++)
{
x[i]=&a[i];
x[i]=&b[i];
printf("%d\n", x[i]);
}
//x[i]=&b[b];
//for(i=0; i<5; i++){
//printf("%d", (*x)[i]);
//}
system("PAUSE"); 
return 0;
}
.......................
// This program demonstrate the functions of arrays and pointer realtionship
#include <iostream>
using namespace std;
main()
{

int x[5] = {0,1,2,3,4}; //declared array of pointer integer type five element4
int *xptr;
int a[5] = {1,2,3,4,5}; //Declare and initialize integer array of five elements
char b[5] = {'a','b','c','d','e'}; //Declare and initialize an array of character type

int i;
for (i=0; i<5; i++)
{
cout"\n A["i"]:"*xptr;
xptr++;
coutendl;
}


system("\nPAUSE");
}
..................
// example about structures
#include <iostream>
#include <string>
#include <sstream> 


using namespace std; 


struct movies_t {
string title; 
int year; 
} mine, yours; 

void printmovie (movies_t movie); 

int main () 
string mystr; 

mine.title = "2001 A Space Odyssey"; 
mine.year = 1968; 

cout << "Enter title: "; 
getline (cin,yours.title); 
cout << "Enter year: "; 
getline (cin,mystr); 
stringstream(mystr) >> yours.year; 

cout << "My favorite vu39 movie is:\n "; 
printmovie (mine); 
cout << "And yours is:\n "; 
printmovie (yours); 
return 0; 

void printmovie (movies_t movie) 
cout << movie.title; 
cout << " (" << movie.year << ")\n"; 
}
................
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int *x[5];
int a[5] = {1,2,3,4,5};
char b[5] = {'a','b','c','d','e'};
int i,j;
printf("4th points Answer\n");
for (i=0; i<5; i++)
{
x[i]=&a[i];
printf("%d\n", *x[i]);
}
printf("5th points Answer\n");
for ( j=0; j<5; j++)
{
*x[j]=b[j];
printf("%d\n", *x[j]);
}

printf("6th points Answer\n");
for ( j=0; j<5; j++)
{
printf("%d\n", a[j]);
}
system("PAUSE"); 
return 0;
}
Copy understand and then paste the code...
..................


Back to home VUsolutions

Shaadi.com: Just create ur account & find ur partner or EARN money, its reall & EASY

VUsolutions Followers (Join NOW and Get Extra Benefits)

Install LATEST toolbar having lot of features - GET solutions on Desktop

toolbar powered by Conduit
Caliplus 300x250 NoFlam VitoLiv 468x60 GlucoLo